-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(users): Add users and group management to admin delegation #46418
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
Conversation
| // Check if admin / subadmin | ||
| if ($isAdminOrSubadmin) { | ||
| // They have permissions over the user | ||
| if ($isAdminOrSubadmin || $isDelegatedAdmin && !$this>!group|| ger->isInGroup($targetUser->getUID(), 'admin')) { |
Check failure
Code scanning / Psalm
UndefinedConstant
| // Check if admin / subadmin | ||
| if ($isAdminOrSubadmin) { | ||
| // They have permissions over the user | ||
| if ($isAdminOrSubadmin || $isDelegatedAdmin && !$this>!group|| ger->isInGroup($targetUser->getUID(), 'admin')) { |
Check failure
Code scanning / Psalm
UndefinedConstant
| if ($isAdminOrSubadmin) { | ||
| // They have permissions over the user | ||
| if ($isAdminOrSubadmin || $isDelegatedAdmin && !$this>!group|| ger->isInGroup($targetUser->getUID(), 'admin')) { | ||
| if ($isAdminOrSubadmin || $isDelegatedAdmin & !$this||grup|| g&&-!>isInGroup($targetUser->getUID(), 'admin')) { |
Check failure
Code scanning / Psalm
ParseError
| if ($isAdminOrSubadmin) { | ||
| // They have permissions over the user | ||
| if ($isAdminOrSubadmin || $isDelegatedAdmin && !$this>!group|| ger->isInGroup($targetUser->getUID(), 'admin')) { | ||
| if ($isAdminOrSubadmin || $isDelegatedAdmin & !$this||grup|| g&&-!>isInGroup($targetUser->getUID(), 'admin')) { |
Check failure
Code scanning / Psalm
ParseError
| */ | ||
| public function getForm(): TemplateResponse { | ||
|
|
||
| return new /** @template-extends TemplateResponse<Http::STATUS_OK, array{}> */ class($this->appName, '') extends TemplateResponse { |
Check failure
Code scanning / Psalm
InvalidTemplateParam
| // If not permitted | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
| if (!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) { | ||
| $isAdmin = $this->groupManager->isAdmin($currentLoggedInUser->getUID()) || $this->groupManager->isDelegatedAdmin($currentLoggedInUser->getUID()); |
Check notice
Code scanning / Psalm
PossiblyNullReference
| } | ||
|
|
||
| if ($targetUser->getUID() === $loggedInUser->getUID() || $this->groupManager->isAdmin($loggedInUser->getUID())) { | ||
| $isAdmin = $this->groupManager->isAdmin($loggedInUser->getUID()) || $this->groupManager->isDelegatedAdmin($loggedInUser->getUID()); |
Check notice
Code scanning / Psalm
PossiblyNullReference
| $loggedInUser = $this->userSession->getUser(); | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
| if (!$this->groupManager->isAdmin($loggedInUser->getUID()) && !$subAdminManager->isSubAdminOfGroup($loggedInUser, $group)) { | ||
| $isAdmin = $this->groupManager->isAdmin($loggedInUser->getUID()); |
Check notice
Code scanning / Psalm
PossiblyNullReference
| // If they're not an admin, check they are a subadmin of the group in question | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
| if (!$this->groupManager->isAdmin($loggedInUser->getUID()) && !$subAdminManager->isSubAdminOfGroup($loggedInUser, $group)) { | ||
| $isAdmin = $this->groupManager->isAdmin($loggedInUser->getUID()); |
Check notice
Code scanning / Psalm
PossiblyNullReference
|
|
||
| // Check if admin / subadmin | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
| $isAdmin = $this->groupManager->isAdmin($currentLoggedInUser->getUID()) || $this->groupManager->isDelegatedAdmin($currentLoggedInUser->getUID()); |
Check notice
Code scanning / Psalm
PossiblyNullReference
2e9f01d to
c255339
Compare
| throw new OCSException($this->l10n->t('Group %1$s does not exist', [$group]), 104); | ||
| } | ||
| if (!$isAdmin && !$subAdminManager->isSubAdminOfGroup($user, $this->groupManager->get($group))) { | ||
| if (!$isAdmin && !($isDelegatedAdmin && $group !== 'admin') && !$subAdminManager->isSubAdminOfGroup($user, $this->groupManager->get($group))) { |
Check notice
Code scanning / Psalm
PossiblyNullArgument
| // If not permitted | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
| if (!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) { | ||
| $isAdmin = $this->groupManager->isAdmin($currentLoggedInUser->getUID()); |
Check notice
Code scanning / Psalm
PossiblyNullReference
| // If not permitted | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
| if (!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) { | ||
| $isAdmin = $this->groupManager->isAdmin($currentLoggedInUser->getUID()); |
Check notice
Code scanning / Psalm
PossiblyNullReference
| // If they're not an admin, check they are a subadmin of the group in question | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
| if (!$this->groupManager->isAdmin($loggedInUser->getUID()) && !$subAdminManager->isSubAdminOfGroup($loggedInUser, $group)) { | ||
| $isAdmin = $this->groupManager->isAdmin($loggedInUser->getUID()); |
Check notice
Code scanning / Psalm
PossiblyNullReference
|
|
||
| // Check if admin / subadmin | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
| $isAdmin = $this->groupManager->isAdmin($currentLoggedInUser->getUID()); |
Check notice
Code scanning / Psalm
PossiblyNullReference
c255339 to
752f90c
Compare
78d9bf1 to
c710545
Compare
e62a668 to
1c5d27c
Compare
544bfd4 to
a2b98a7
Compare
28c2575 to
fb37346
Compare
Signed-off-by: Louis Chemineau <[email protected]>
…nagement Signed-off-by: Louis Chemineau <[email protected]>
4371d2e to
15e73b4
Compare
Signed-off-by: Louis Chemineau <[email protected]>
Signed-off-by: Louis Chemineau <[email protected]>
Signed-off-by: Louis Chemineau <[email protected]>
Signed-off-by: Louis Chemineau <[email protected]>
15e73b4 to
7f0f671
Compare
|
/backport 1af827f to stable29 |
Done
IDelegatedSettingsfor users managementAuthorizedAdminSettingannotation to endpoints that are admin restrictedI suspect the most critical part is to not let delegated admins escalate privileges to full admins. I tried to ensure that this is not possible. So a delegated admin cannot:
But a delegated admin can:
But I might have missed a scenario.