File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ def person_role_level_id_by_role(role)
114
114
end
115
115
116
116
def update_person_with_auth_user_id
117
- ldap_username = @ptime_employee_attributes [ :ldap_username ]
117
+ ldap_username = @ptime_employee_attributes [ :ldapname ]
118
118
@person . auth_user_id = AuthUser . find_by ( ldap_username :) &.id
119
119
end
120
120
end
Original file line number Diff line number Diff line change @@ -6,17 +6,19 @@ class AuthUser < ApplicationRecord
6
6
7
7
class << self
8
8
def from_omniauth ( auth )
9
- person = where ( uid : auth . uid ) . first_or_create do |user |
10
- user . name = auth . info . name
11
- user . email = auth . info . email
12
- user . ldap_username = auth . extra . raw_info . pitc . uid
13
- end
9
+ person = where ( uid : auth . uid ) . first_or_create { |user | initialize_user ( user , auth ) }
14
10
person . last_login = Time . zone . now
15
11
set_admin ( person , auth )
16
12
end
17
13
18
14
private
19
15
16
+ def initialize_user ( user , auth )
17
+ user . name = auth . info . name
18
+ user . email = auth . info . email
19
+ user . ldap_username = auth . extra . raw_info . pitc . uid
20
+ end
21
+
20
22
def set_admin ( person , auth )
21
23
person . is_admin = role? ( auth , AuthConfig . admin_role )
22
24
person . is_conf_admin = role? ( auth , AuthConfig . conf_admin_role )
You can’t perform that action at this time.
0 commit comments