Merge pull request #5571 from Luzifer/5570_backend_admin
Allow group backend to declare users as admins
This commit is contained in:
commit
a10c4517cb
|
@ -38,6 +38,7 @@ abstract class Backend implements \OCP\GroupInterface {
|
||||||
self::REMOVE_FROM_GOUP => 'removeFromGroup',
|
self::REMOVE_FROM_GOUP => 'removeFromGroup',
|
||||||
self::COUNT_USERS => 'countUsersInGroup',
|
self::COUNT_USERS => 'countUsersInGroup',
|
||||||
self::GROUP_DETAILS => 'getGroupDetails',
|
self::GROUP_DETAILS => 'getGroupDetails',
|
||||||
|
self::IS_ADMIN => 'isAdmin',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -288,6 +288,11 @@ class Manager extends PublicEmitter implements IGroupManager {
|
||||||
* @return bool if admin
|
* @return bool if admin
|
||||||
*/
|
*/
|
||||||
public function isAdmin($userId) {
|
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');
|
return $this->isInGroup($userId, 'admin');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,10 @@ interface GroupInterface {
|
||||||
//OBSOLETE const GET_DISPLAYNAME = 0x00010000;
|
//OBSOLETE const GET_DISPLAYNAME = 0x00010000;
|
||||||
const COUNT_USERS = 0x00100000;
|
const COUNT_USERS = 0x00100000;
|
||||||
const GROUP_DETAILS = 0x01000000;
|
const GROUP_DETAILS = 0x01000000;
|
||||||
|
/**
|
||||||
|
* @since 13.0.0
|
||||||
|
*/
|
||||||
|
const IS_ADMIN = 0x10000000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if backend implements actions
|
* Check if backend implements actions
|
||||||
|
|
Loading…
Reference in New Issue