diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2015-08-11 15:37:06 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2015-08-11 15:37:06 +0200 |
commit | b41bccd38532a2b806a92055e29926a3e85cfb37 (patch) | |
tree | 65369d3effcc797407d13081646b4a0d5fbd0405 /apps/provisioning_api/lib/groups.php | |
parent | b25c3beb2f8bb61fbf40b183e425b3d4799c3afa (diff) | |
download | nextcloud-server-b41bccd38532a2b806a92055e29926a3e85cfb37.tar.gz nextcloud-server-b41bccd38532a2b806a92055e29926a3e85cfb37.zip |
Check for userSession->getUser() === null
Diffstat (limited to 'apps/provisioning_api/lib/groups.php')
-rw-r--r-- | apps/provisioning_api/lib/groups.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/provisioning_api/lib/groups.php b/apps/provisioning_api/lib/groups.php index 11f3995e1da..91d0a1c6342 100644 --- a/apps/provisioning_api/lib/groups.php +++ b/apps/provisioning_api/lib/groups.php @@ -63,14 +63,20 @@ class Groups{ /** * returns an array of users in the group specified */ - public function getGroup($parameters){ + public function getGroup($parameters) { + // Check if user is logged in + $user = $this->userSession->getUser(); + if ($user === null) { + return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED); + } + // Check the group exists if(!$this->groupManager->groupExists($parameters['groupid'])){ return new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested group could not be found'); } // Check subadmin has access to this group - if($this->groupManager->isAdmin($this->userSession->getUser()->getUID()) - || in_array($parameters['groupid'], \OC_SubAdmin::getSubAdminsGroups($this->userSession->getUser()->getUID()))){ + if($this->groupManager->isAdmin($user->getUID()) + || in_array($parameters['groupid'], \OC_SubAdmin::getSubAdminsGroups($user->getUID()))){ $users = $this->groupManager->get($parameters['groupid'])->getUsers(); $users = array_map(function($user) { return $user->getUID(); |