Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tortuetorche
Copy link
Contributor

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

…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();
Copy link
Member

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();
Copy link
Member

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())
) {
Copy link
Member

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)

@blizzz blizzz added this to the Nextcloud 25 milestone Apr 21, 2022
@blizzz blizzz modified the milestones: Nextcloud 25, Nextcloud 26 Sep 22, 2022
@blizzz blizzz modified the milestones: Nextcloud 26, Nextcloud 27 Mar 9, 2023
@blizzz blizzz modified the milestones: Nextcloud 27, Nextcloud 28 May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-admin users should not be able to add group(s) to circles
4 participants