Allow group backend to declare users as admins
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
2afb4857cc
commit
92d2fb8771
3 changed files with 7 additions and 0 deletions
|
@ -38,6 +38,7 @@ abstract class Backend implements \OCP\GroupInterface {
|
|||
self::REMOVE_FROM_GOUP => 'removeFromGroup',
|
||||
self::COUNT_USERS => 'countUsersInGroup',
|
||||
self::GROUP_DETAILS => 'getGroupDetails',
|
||||
self::IS_ADMIN => 'isAdmin',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -288,6 +288,11 @@ class Manager extends PublicEmitter implements IGroupManager {
|
|||
* @return bool if admin
|
||||
*/
|
||||
public function isAdmin($userId) {
|
||||
foreach ($this->backends as $backend) {
|
||||
if ($backend->implementsActions(\OC\Group\Backend::IS_ADMIN) && $backend->isAdmin($userId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return $this->isInGroup($userId, 'admin');
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ interface GroupInterface {
|
|||
//OBSOLETE const GET_DISPLAYNAME = 0x00010000;
|
||||
const COUNT_USERS = 0x00100000;
|
||||
const GROUP_DETAILS = 0x01000000;
|
||||
const IS_ADMIN = 0x10000000;
|
||||
|
||||
/**
|
||||
* Check if backend implements actions
|
||||
|
|
Loading…
Reference in a new issue