diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2013-01-14 19:45:17 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2013-01-14 19:45:17 +0100 |
commit | 31b1a73e1f508a33843835b632ee05c7bfc2aaaf (patch) | |
tree | e590662315799744155151b2c6c9148d2e9e860e /lib/json.php | |
parent | fa78fbe0c3e281c91468bee92c871be7b1e48c79 (diff) | |
download | nextcloud-server-31b1a73e1f508a33843835b632ee05c7bfc2aaaf.tar.gz nextcloud-server-31b1a73e1f508a33843835b632ee05c7bfc2aaaf.zip |
Check if user is admin - bool
There was no "isAdminUser()" function which returned bool. This is
irritiating as there were a loooooooot of places in the code which
checked this itself with `OC_Group::inGroup($uid, 'admin)` - why not
use a function for this?
(Especially if you consider that we might change the group name in the
future, which would lead to problems then)
Additionally, @Raydiation needed such a method for his AppFramework :)
Diffstat (limited to 'lib/json.php')
-rw-r--r-- | lib/json.php | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/json.php b/lib/json.php index 204430411c0..5ab877540d4 100644 --- a/lib/json.php +++ b/lib/json.php @@ -57,9 +57,7 @@ class OC_JSON{ * Check if the user is a admin, send json error msg if not */ public static function checkAdminUser() { - self::checkLoggedIn(); - self::verifyUser(); - if( !OC_Group::inGroup( OC_User::getUser(), 'admin' )) { + if( !OC_User::isAdminUser(OC_User::getUser())) { $l = OC_L10N::get('lib'); self::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); exit(); @@ -70,9 +68,7 @@ class OC_JSON{ * Check if the user is a subadmin, send json error msg if not */ public static function checkSubAdminUser() { - self::checkLoggedIn(); - self::verifyUser(); - if(!OC_Group::inGroup(OC_User::getUser(), 'admin') && !OC_SubAdmin::isSubAdmin(OC_User::getUser())) { + if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) { $l = OC_L10N::get('lib'); self::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); exit(); |