aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKnut Ahlers <knut@ahlers.me>2017-06-30 13:32:11 +0200
committerKnut Ahlers <knut@ahlers.me>2017-06-30 14:28:16 +0200
commit92d2fb8771bbdeddda0f9593bf36b854729bbb40 (patch)
treee3ac4368836f3fee1d5d9656905f775b23536e3e /lib
parent2afb4857cca4ca5eb48af63ab814727cfe77b1bd (diff)
downloadnextcloud-server-92d2fb8771bbdeddda0f9593bf36b854729bbb40.tar.gz
nextcloud-server-92d2fb8771bbdeddda0f9593bf36b854729bbb40.zip
Allow group backend to declare users as admins
Signed-off-by: Knut Ahlers <knut@ahlers.me>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Group/Backend.php1
-rw-r--r--lib/private/Group/Manager.php5
-rw-r--r--lib/public/GroupInterface.php1
3 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php
index 1e8d62f5e42..001d8d9da66 100644
--- a/lib/private/Group/Backend.php
+++ b/lib/private/Group/Backend.php
@@ -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',
];
/**
diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php
index 61b47fdd448..dad6ee18471 100644
--- a/lib/private/Group/Manager.php
+++ b/lib/private/Group/Manager.php
@@ -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');
}
diff --git a/lib/public/GroupInterface.php b/lib/public/GroupInterface.php
index 97837e50b16..a9b1fd1724d 100644
--- a/lib/public/GroupInterface.php
+++ b/lib/public/GroupInterface.php
@@ -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