Skip to content

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>
$groupManager = OC::$server->getGroupManager();

$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
@blizzz blizzz added this to the Nextcloud 30 milestone Apr 8, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 22, 2024
44 tasks
@blizzz blizzz mentioned this pull request Jan 29, 2025
1 task
@blizzz blizzz modified the milestones: Nextcloud 31, Nextcloud 32 Jan 29, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
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

5 participants