From dde24c5f93a792d21c39d70deeece9b626aaa41a Mon Sep 17 00:00:00 2001 From: Sebb Date: Sun, 6 Oct 2024 12:01:24 +0100 Subject: [PATCH] We only want memberids here, so don't call members needlessly --- lib/whimsy/asf/ldap.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb index 90b210dff6..7a5bca0b63 100644 --- a/lib/whimsy/asf/ldap.rb +++ b/lib/whimsy/asf/ldap.rb @@ -1172,8 +1172,9 @@ def dn # remove people from an existing group in LDAP def remove(people) + # Removal fails if the id is not present @members = nil # force fresh LDAP search - people = (Array(people) & members).map(&:id) + people = Array(people).map(&:id) & memberids return if people.empty? ASF::LDAP.modify(self.dn, [ASF::Base.mod_delete('memberUid', people)]) ensure @@ -1182,8 +1183,9 @@ def remove(people) # add people to an existing group in LDAP def add(people) + # addition fails if the id is present @members = nil # force fresh LDAP search - people = (Array(people) - members).map(&:id) + people = Array(people).map(&:id) - memberids return if people.empty? ASF::LDAP.modify(self.dn, [ASF::Base.mod_add('memberUid', people)]) ensure @@ -1328,6 +1330,7 @@ def remove(people) # remove people as owners of a project in LDAP def remove_owners(people) + # Removal fails if the id is not present @owners = nil # force fresh LDAP search removals = (Array(people) & owners).map(&:dn) unless removals.empty? @@ -1339,6 +1342,7 @@ def remove_owners(people) # remove people as members of a project in LDAP def remove_members(people) + # Removal fails if the id is not present @members = nil # force fresh LDAP search removals = (Array(people) & members).map(&:dn) unless removals.empty? @@ -1356,6 +1360,7 @@ def add(people) # add people as owners of a project in LDAP def add_owners(people) + # Addition fails if the id is present @owners = nil # force fresh LDAP search additions = (Array(people) - owners).map(&:dn) unless additions.empty? @@ -1367,6 +1372,7 @@ def add_owners(people) # add people as members of a project in LDAP def add_members(people) + # Addition fails if the id is present @members = nil # force fresh LDAP search additions = (Array(people) - members).map(&:dn) unless additions.empty?