biola_wcms_components 0.25.1 → 0.25.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/biola_wcms_components/version.rb +1 -1
- data/lib/components/cas_authentication.rb +20 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08f057cd72ef31f9c6c6859de0446819808e19af
|
4
|
+
data.tar.gz: a847ab856b8a12763358d884a6e0a9de105b79b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c41ec02388c8bac7bb2a73fb215fb3cccf3cc97ae1f734a983c04758b9c71eb47bdd9ca44efae26e1eda258d3d8e8b555a3f07d72d390619466121f0817be3f
|
7
|
+
data.tar.gz: a8fad43b098232738fd2423c7019e88c6292c3150297389f5ffcabe893a89e05815081e1012a10e830ff3958bc4af91523bea8a739e81993707b281cbdb23556
|
data/CHANGELOG.md
CHANGED
@@ -27,13 +27,13 @@ class CasAuthentication
|
|
27
27
|
attr_reader :session
|
28
28
|
|
29
29
|
USER_CAS_MAP = {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
employeeId: { biola_id: Integer },
|
31
|
+
eduPersonNickname: :first_name,
|
32
|
+
sn: :last_name,
|
33
|
+
mail: :email,
|
34
|
+
url: :photo_url,
|
35
|
+
eduPersonEntitlement: { entitlements: Array },
|
36
|
+
eduPersonAffiliation: { affiliations: Array }
|
37
37
|
}.freeze
|
38
38
|
|
39
39
|
def present?
|
@@ -57,9 +57,12 @@ class CasAuthentication
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def update_extra_attributes!
|
60
|
-
USER_CAS_MAP.each do |
|
61
|
-
|
60
|
+
USER_CAS_MAP.each do |attr_key, opt|
|
61
|
+
next unless extra_attrs.key?(attr_key)
|
62
|
+
key, type = user_key_type(opt)
|
63
|
+
user[key] = attr_value(extra_attrs[attr_key], type)
|
62
64
|
end
|
65
|
+
|
63
66
|
user.save
|
64
67
|
end
|
65
68
|
alias create_user! update_extra_attributes!
|
@@ -76,17 +79,15 @@ class CasAuthentication
|
|
76
79
|
@extra_attrs ||= (attrs[:extra_attributes] || {}).with_indifferent_access
|
77
80
|
end
|
78
81
|
|
79
|
-
def attr_value(
|
80
|
-
return
|
81
|
-
|
82
|
+
def attr_value(value, type = nil)
|
83
|
+
return Array(value).compact if type == Array
|
84
|
+
return Integer(value) if type == Integer &&
|
85
|
+
/\A\d+\z/ =~ value.to_s
|
86
|
+
String(value)
|
82
87
|
end
|
83
88
|
|
84
|
-
def
|
85
|
-
return
|
86
|
-
|
87
|
-
key, type = hash.first
|
88
|
-
return Array(opts.try(:[], key)).compact if type == Array
|
89
|
-
return Integer(opts.try(:[], key)) if type == Integer &&
|
90
|
-
/\A\d+\z/ =~ opts[key].to_s
|
89
|
+
def user_key_type(opt)
|
90
|
+
return opt if opt.is_a? Symbol
|
91
|
+
opt.first
|
91
92
|
end
|
92
93
|
end
|