Class: EgovUtils::RefreshGroups
- Inherits:
-
Object
- Object
- EgovUtils::RefreshGroups
- Defined in:
- app/services/egov_utils/refresh_groups.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/egov_utils/refresh_groups.rb', line 4 def call hsh = groups.each_with_object({}) do |group, memo| infos = group.ldap_members infos.each do |info| memo[info] ||= [] memo[info] << group end end hsh.each do |info, groups| user = EgovUtils::User.find_by(login: info[:login]) next unless user all_groups = user.groups.where(ldap_uid: nil) + groups user.update(info.merge(groups: all_groups)) end end |