summaryrefslogtreecommitdiffstats
path: root/lib/json.php
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-07-18 17:10:53 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-07-18 17:11:09 +0200
commita5bebb86a59a156d00bbd36f477696ddd38ca092 (patch)
treefb7b0123d240b56afcf9fabbe47f2481d2b7d489 /lib/json.php
parentf503aea09999e55bb2e51e87fbdd769092a97501 (diff)
downloadnextcloud-server-a5bebb86a59a156d00bbd36f477696ddd38ca092.tar.gz
nextcloud-server-a5bebb86a59a156d00bbd36f477696ddd38ca092.zip
add checkSubAdminUser method to OC_JSON class
Diffstat (limited to 'lib/json.php')
-rw-r--r--lib/json.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/json.php b/lib/json.php
index c49b831c12b..b0d3d918657 100644
--- a/lib/json.php
+++ b/lib/json.php
@@ -64,6 +64,18 @@ class OC_JSON{
exit();
}
}
+
+ /**
+ * Check if the user is a subadmin, send json error msg if not
+ */
+ public static function checkSubAdminUser(){
+ self::checkLoggedIn();
+ if(!OC_Group::inGroup(OC_User::getUser(),'admin') && !OC_SubAdmin::isSubAdmin(OC_User::getUser())){
+ $l = OC_L10N::get('core');
+ self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
+ exit();
+ }
+ }
/**
* Send json error msg