-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add allow_adding_any_group_members
option
#398
base: master
Are you sure you want to change the base?
Add allow_adding_any_group_members
option
#398
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>
|
||
$groups = $groupManager->search($search); | ||
$user = OC::$server->getUserSession()->getUser(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()) | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
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