ucb_rails_user 4.1.1 → 4.1.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2d32568b7c7c44c29b420b560c94db14a5cef2150e40e69b535cc9fad3b6714
|
4
|
+
data.tar.gz: 7325bbb7ee1f6cd3ea3a04c7f38411d5e75551c31022260ba454d22769c60d2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efb9dd7b036a5de8251cab4068172cea5fdcce1db57be780d0e70111d90b634dc591a09fadc8b81206a6005f6d2b4a59cc63b31d729716abfc3a396492567b82
|
7
|
+
data.tar.gz: 7f0beaa12b968857a56c1c6a8966c51a77447f975c88494c5e6c4022d5ad712b7be085c91c6a0ab267d3d454de9cfd38b5f979c61becc2c3812d2853dfb224d7
|
@@ -14,6 +14,7 @@ module UcbRailsUser::LdapPerson
|
|
14
14
|
attribute :first_name
|
15
15
|
attribute :last_name
|
16
16
|
attribute :email
|
17
|
+
attribute :alternate_email
|
17
18
|
attribute :phone
|
18
19
|
attribute :departments
|
19
20
|
attribute :affiliations
|
@@ -40,19 +41,23 @@ module UcbRailsUser::LdapPerson
|
|
40
41
|
class << self
|
41
42
|
|
42
43
|
def new_from_ldap_entry(ldap_entry)
|
44
|
+
# the to_s calls are because the underlying LDAP library sometimes returns strings as instances
|
45
|
+
# of Net::BER::BerIdentifiedString rather than String, and the Oracle DB library doesn't play
|
46
|
+
# nicely with those (postgres and sqlite work fine)
|
43
47
|
new(
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
48
|
+
uid: ldap_entry.uid&.to_s,
|
49
|
+
calnet_id: ldap_entry.berkeleyedukerberosprincipalstring.first&.to_s,
|
50
|
+
employee_id: ldap_entry.attributes[:berkeleyeduucpathid]&.first&.to_s,
|
51
|
+
student_id: ldap_entry.berkeleyedustuid&.to_s,
|
52
|
+
first_name: ldap_entry.givenname.first&.to_s,
|
53
|
+
last_name: ldap_entry.sn.first&.to_s,
|
54
|
+
email: ldap_entry.mail.first&.to_s,
|
55
|
+
alternate_email: ldap_entry.attributes[:berkeleyeduofficialemail]&.first&.to_s,
|
56
|
+
phone: ldap_entry.phone&.to_s,
|
57
|
+
departments: ldap_entry.berkeleyeduunithrdeptname&.to_s,
|
58
|
+
affiliations: ldap_entry.berkeleyeduaffiliations&.map(&:to_s),
|
59
|
+
affiliate_id: ldap_entry.berkeleyeduaffid.first&.to_s,
|
60
|
+
inactive: ldap_entry.expired? || false
|
56
61
|
)
|
57
62
|
end
|
58
63
|
|
@@ -8,6 +8,9 @@ module UcbRailsUser
|
|
8
8
|
|
9
9
|
if people_ou_entry.present?
|
10
10
|
UcbRailsUser::UserLdapService.create_or_update_user_from_entry(people_ou_entry).tap do |user|
|
11
|
+
if missing_or_invalid_email?(user)
|
12
|
+
user.update(email: people_ou_entry.alternate_email) if people_ou_entry.alternate_email.present?
|
13
|
+
end
|
11
14
|
user.touch(:last_login_at)
|
12
15
|
end
|
13
16
|
else
|
@@ -15,6 +18,12 @@ module UcbRailsUser
|
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
21
|
+
private
|
22
|
+
|
23
|
+
def missing_or_invalid_email?(user)
|
24
|
+
user&.email.blank? || (user.email =~ URI::MailTo::EMAIL_REGEXP).nil?
|
25
|
+
end
|
26
|
+
|
18
27
|
end
|
19
28
|
|
20
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucb_rails_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Downey
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-
|
14
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|