diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-01-21 14:32:30 +0400 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-01-21 14:32:30 +0400 |
commit | 23a4d0d44ef8b918f054e7ad608d04b2e9a68995 (patch) | |
tree | 97e921688f32f8b5a707e4d81d5486d9793a3558 /lib/private/json.php | |
parent | 0f794b6889d05508c86449dacdee3e05bd47d071 (diff) |
OC_Util::setupFS($user) will create a data dir for the given string - no matter if the user really exists - OCP\JSON::checkUserExists($owner); introduces a ready to use check which will bail out with an JSON error
Diffstat (limited to 'lib/private/json.php')
-rw-r--r-- | lib/private/json.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/private/json.php b/lib/private/json.php index 6a9e5a2df5e..5c5d7e3a3da 100644 --- a/lib/private/json.php +++ b/lib/private/json.php @@ -65,6 +65,20 @@ class OC_JSON{ } /** + * Check is a given user exists - send json error msg if not + * @param string $user + */ + public static function checkUserExists($user) { + if (!OCP\User::userExists($user)) { + $l = OC_L10N::get('lib'); + OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user')))); + exit; + } + } + + + + /** * Check if the user is a subadmin, send json error msg if not */ public static function checkSubAdminUser() { |