Add allow_adding_any_group_members option#398
Open
tortuetorche wants to merge 1 commit intonextcloud:masterfrom
Open
Add allow_adding_any_group_members option#398tortuetorche wants to merge 1 commit intonextcloud:masterfrom
allow_adding_any_group_members option#398tortuetorche wants to merge 1 commit intonextcloud:masterfrom
Conversation
…oup members from any users Default to `1`. When value is set to `0` it's only possible to add groups where the current user is a member or for global administrators. Fix nextcloud#128 Signed-off-by: Tortue Torche <tortuetorche@users.noreply.github.com>
| $groupManager = OC::$server->getGroupManager(); | ||
|
|
||
| $groups = $groupManager->search($search); | ||
| $user = OC::$server->getUserSession()->getUser(); |
Member
There was a problem hiding this comment.
should be added as a parameter of the __construct(). can you do the same with IGroupManager ?
| $groupManager = OC::$server->getGroupManager(); | ||
| $group = $groupManager->get($groupId); | ||
|
|
||
| $user = OC::$server->getUserSession()->getUser(); |
Member
There was a problem hiding this comment.
should be added as a parameter of the __construct(). can you do the same with IGroupManager ?
| if (!$this->configService->isAddingAnyGroupMembersAllowed() && | ||
| $group instanceof IGroup && $user instanceof IUser && | ||
| !$group->inGroup($user) && !$groupManager->isAdmin($user->getUID()) | ||
| ) { |
Member
There was a problem hiding this comment.
I am not a fan of this condition; let's assume that user is not null, I prefer having an unhandled exception than a failed condition. something like if ($group !== null && [...]->isAddingAnyGroupMembersAllowed() && not in group && not admin)
This was referenced Aug 12, 2022
This was referenced Aug 24, 2022
This was referenced Sep 6, 2022
This was referenced Sep 20, 2022
This was referenced May 3, 2023
This was referenced Jan 14, 2025
This was referenced Jan 21, 2025
This was referenced Aug 22, 2025
This was referenced Sep 2, 2025
This was referenced Sep 25, 2025
This was referenced Jan 7, 2026
This was referenced Jan 14, 2026
This was referenced Jan 29, 2026
This was referenced Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To allow or not adding group members from any users, default to
1.When value is set to
0, it's only possible to add groups where the current user is a member or for global administrators.Fix #128