Skip to content

Commit

Permalink
fix: added org_id to ldap group mapping functions (#466)
Browse files Browse the repository at this point in the history
* fix: added org_id to ldap group mapping functions to support more than one org pr instance

* fix: added org_id to ldap group mapping functions to support more than one org pr instance

* doc: added to to the changelog

* fix: cookstyle error

* fix: markdown  error

* fix: markdown  error

---------

Co-authored-by: Simen Andrè Vikestrand Skogum <[email protected]>
  • Loading branch information
v0nNemizez and Simen Andrè Vikestrand Skogum authored Sep 27, 2024
1 parent 9f1efe3 commit c69b263
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file is used to list changes made in each version of grafana.

## Unreleased

- Added org_ids to ldap_mapping functions

## 10.7.4 - *2024-07-15*

Standardise files with files in sous-chefs/repo-management
Expand Down
6 changes: 3 additions & 3 deletions resources/config_ldap_group_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def group_mapping_exist?

return unless group_mappings

group_mappings.any? { |gm| gm['group_dn'].eql?(new_resource.group_dn) && gm['org_role'].eql?(new_resource.org_role) }
group_mappings.any? { |gm| gm['group_dn'].eql?(new_resource.group_dn) && gm['org_role'].eql?(new_resource.org_role) && gm['org_id'].eql?(new_resource.org_id) }
end

def remove_group_mapping
Expand All @@ -81,7 +81,7 @@ def remove_group_mapping

return unless group_mappings

group_mappings.delete_if { |gm| gm['group_dn'].eql?(new_resource.group_dn) && gm['org_role'].eql?(new_resource.org_role) }
group_mappings.delete_if { |gm| gm['group_dn'].eql?(new_resource.group_dn) && gm['org_role'].eql?(new_resource.org_role) && gm['org_id'].eql?(new_resource.org_id) }
end
end

Expand All @@ -103,5 +103,5 @@ def remove_group_mapping
end

action :delete do
converge_by("Remove LDAP server #{new_resource.host} group mapping for #{new_resource.group_dn}") { remove_group_mapping } if group_mapping_exist?
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

0 comments on commit c69b263

Please sign in to comment.