From a5bebb86a59a156d00bbd36f477696ddd38ca092 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 18 Jul 2012 17:10:53 +0200 Subject: [PATCH] add checkSubAdminUser method to OC_JSON class --- lib/json.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/json.php b/lib/json.php index c49b831c12..b0d3d91865 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