bsm-sso-client 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,15 +6,17 @@ module Bsm::Sso::Client::Cached::ActiveRecord
|
|
6
6
|
include Bsm::Sso::Client::UserMethods
|
7
7
|
|
8
8
|
included do
|
9
|
-
|
10
|
-
|
9
|
+
self.mass_assignment_sanitizer = :logger # SSO might send more than we can chew
|
10
|
+
|
11
|
+
validates :id, presence: true, on: :create
|
12
|
+
attr_accessible :id, :email, :kind, :level, :authentication_token, as: :sso
|
11
13
|
end
|
12
14
|
|
13
15
|
module ClassMethods
|
14
16
|
|
15
17
|
# Retrieve cached
|
16
18
|
def sso_find(id)
|
17
|
-
where(:
|
19
|
+
where(id: id).first || super
|
18
20
|
end
|
19
21
|
|
20
22
|
# Cache!
|
@@ -22,18 +24,18 @@ module Bsm::Sso::Client::Cached::ActiveRecord
|
|
22
24
|
return nil if token.blank?
|
23
25
|
|
24
26
|
relation = where(arel_table[:updated_at].gt(Bsm::Sso::Client.expire_after.ago))
|
25
|
-
relation = relation.where(:
|
27
|
+
relation = relation.where(authentication_token: token)
|
26
28
|
relation.first || super
|
27
29
|
end
|
28
30
|
|
29
31
|
# Cache!
|
30
32
|
def sso_cache(resource, action = nil)
|
31
|
-
if record = where(:
|
32
|
-
record.assign_attributes resource.attributes, :
|
33
|
+
if record = where(id: resource.id).first
|
34
|
+
record.assign_attributes resource.attributes, as: :sso
|
33
35
|
record.changed? ? record.save! : record.touch
|
34
36
|
record
|
35
37
|
else
|
36
|
-
create! resource.attributes, :
|
38
|
+
create! resource.attributes, as: :sso
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bsm-sso-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|