Allow group backend to declare users as admins

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-06-30 13:32:11 +02:00
parent 2afb4857cc
commit 92d2fb8771
No known key found for this signature in database
GPG key ID: DC2729FDD34BE99E
3 changed files with 7 additions and 0 deletions

View file

@ -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',
];
/**

View file

@ -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');
}

View file

@ -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