diff --git a/resources/config_ldap_group_mapping.rb b/resources/config_ldap_group_mapping.rb index 7eccb149..0322e2fd 100644 --- a/resources/config_ldap_group_mapping.rb +++ b/resources/config_ldap_group_mapping.rb @@ -91,25 +91,16 @@ def remove_group_mapping converge_if_changed do mapping = resource_properties.map do |rp| next if nil_or_empty?(new_resource.send(rp)) - [rp.to_s, new_resource.send(rp)] end.compact.to_h - # Fjern eksisterende gruppemapping om den finnes remove_group_mapping if group_mapping_exist? - - # Hent eksisterende group_mappings eller opprett en tom liste hvis ingen finnes ldap_server_config(new_resource.host)['group_mappings'] ||= [] - - # Legg til den nye gruppemappingen ldap_server_config(new_resource.host)['group_mappings'].push(mapping) - - # Sorter group_mappings etter org_role ldap_server_config(new_resource.host)['group_mappings'].sort_by! { |gm| gm['org_role'] } end end - action :delete do converge_by("Remove LDAP server #{new_resource.host} group mapping for #{new_resource.group_dn} from OrgID #{new_resource.org_id}") { remove_group_mapping } if group_mapping_exist? end