summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-01-21 07:36:30 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2014-01-21 07:36:30 -0800
commit3a17220c9f015435ef15b70de42b4e6d95236888 (patch)
tree0000ba341d2814871b17236f82a04a30fa928a62 /lib
parent98415d68a5127bc0928455ecff230f53cf990686 (diff)
parent262f221d1119222825a0fbf5d26623f567bd00dd (diff)
downloadnextcloud-server-3a17220c9f015435ef15b70de42b4e6d95236888.tar.gz
nextcloud-server-3a17220c9f015435ef15b70de42b4e6d95236888.zip
Merge pull request #6858 from owncloud/fix-setupfs-only-for-existing-users-master
OC_Util::setupFS($user) will create a data dir for the given string - no...
Diffstat (limited to 'lib')
-rw-r--r--lib/private/json.php14
-rwxr-xr-xlib/private/util.php4
-rw-r--r--lib/public/json.php10
3 files changed, 27 insertions, 1 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() {
diff --git a/lib/private/util.php b/lib/private/util.php
index 72afa6f9478..8aa7a074d0d 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -51,6 +51,10 @@ class OC_Util {
self::$rootMounted = true;
}
+ if ($user != '' && !OCP\User::userExists($user)) {
+ return false;
+ }
+
//if we aren't logged in, there is no use to set up the filesystem
if( $user != "" ) {
\OC\Files\Filesystem::addStorageWrapper(function($mountPoint, $storage){
diff --git a/lib/public/json.php b/lib/public/json.php
index 831e3ef1cf6..cd5d233ef90 100644
--- a/lib/public/json.php
+++ b/lib/public/json.php
@@ -167,7 +167,7 @@ class JSON {
* @return string json formatted string if not admin user.
*/
public static function checkAdminUser() {
- return(\OC_JSON::checkAdminUser());
+ \OC_JSON::checkAdminUser();
}
/**
@@ -177,4 +177,12 @@ class JSON {
public static function encode($data) {
return(\OC_JSON::encode($data));
}
+
+ /**
+ * Check is a given user exists - send json error msg if not
+ * @param string $user
+ */
+ public static function checkUserExists($user) {
+ \OC_JSON::checkUserExists($user);
+ }
}