Merge pull request #5571 from Luzifer/5570_backend_admin

Allow group backend to declare users as admins
This commit is contained in:
Morris Jobke 2017-09-06 19:50:52 +02:00 committed by GitHub
commit a10c4517cb
3 changed files with 10 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,10 @@ interface GroupInterface {
//OBSOLETE const GET_DISPLAYNAME = 0x00010000;
const COUNT_USERS = 0x00100000;
const GROUP_DETAILS = 0x01000000;
/**
* @since 13.0.0
*/
const IS_ADMIN = 0x10000000;
/**
* Check if backend implements actions