aboutsummaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Groups.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/provisioning_api/lib/Groups.php')
-rw-r--r--apps/provisioning_api/lib/Groups.php37
1 files changed, 18 insertions, 19 deletions
diff --git a/apps/provisioning_api/lib/Groups.php b/apps/provisioning_api/lib/Groups.php
index 7b030856381..90a40c07654 100644
--- a/apps/provisioning_api/lib/Groups.php
+++ b/apps/provisioning_api/lib/Groups.php
@@ -25,7 +25,6 @@
namespace OCA\Provisioning_API;
-use \OC_OCS_Result;
use OCP\IGroup;
use OCP\IUser;
@@ -57,7 +56,7 @@ class Groups{
* returns a list of groups
*
* @param array $parameters
- * @return OC_OCS_Result
+ * @return \OC\OCS\Result
*/
public function getGroups($parameters) {
$search = $this->request->getParam('search', '');
@@ -77,27 +76,27 @@ class Groups{
return $group->getGID();
}, $groups);
- return new OC_OCS_Result(['groups' => $groups]);
+ return new \OC\OCS\Result(['groups' => $groups]);
}
/**
* returns an array of users in the group specified
*
* @param array $parameters
- * @return OC_OCS_Result
+ * @return \OC\OCS\Result
*/
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);
+ return new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED);
}
$groupId = $parameters['groupid'];
// Check the group exists
if(!$this->groupManager->groupExists($groupId)) {
- return new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested group could not be found');
+ return new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested group could not be found');
}
$isSubadminOfGroup = false;
@@ -115,9 +114,9 @@ class Groups{
return $user->getUID();
}, $users);
$users = array_values($users);
- return new OC_OCS_Result(['users' => $users]);
+ return new \OC\OCS\Result(['users' => $users]);
} else {
- return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'User does not have access to specified group');
+ return new \OC\OCS\Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'User does not have access to specified group');
}
}
@@ -125,49 +124,49 @@ class Groups{
* creates a new group
*
* @param array $parameters
- * @return OC_OCS_Result
+ * @return \OC\OCS\Result
*/
public function addGroup($parameters) {
// Validate name
$groupId = $this->request->getParam('groupid', '');
if(empty($groupId)){
\OCP\Util::writeLog('provisioning_api', 'Group name not supplied', \OCP\Util::ERROR);
- return new OC_OCS_Result(null, 101, 'Invalid group name');
+ return new \OC\OCS\Result(null, 101, 'Invalid group name');
}
// Check if it exists
if($this->groupManager->groupExists($groupId)){
- return new OC_OCS_Result(null, 102);
+ return new \OC\OCS\Result(null, 102);
}
$this->groupManager->createGroup($groupId);
- return new OC_OCS_Result(null, 100);
+ return new \OC\OCS\Result(null, 100);
}
/**
* @param array $parameters
- * @return OC_OCS_Result
+ * @return \OC\OCS\Result
*/
public function deleteGroup($parameters) {
// Check it exists
if(!$this->groupManager->groupExists($parameters['groupid'])){
- return new OC_OCS_Result(null, 101);
+ return new \OC\OCS\Result(null, 101);
} else if($parameters['groupid'] === 'admin' || !$this->groupManager->get($parameters['groupid'])->delete()){
// Cannot delete admin group
- return new OC_OCS_Result(null, 102);
+ return new \OC\OCS\Result(null, 102);
} else {
- return new OC_OCS_Result(null, 100);
+ return new \OC\OCS\Result(null, 100);
}
}
/**
* @param array $parameters
- * @return OC_OCS_Result
+ * @return \OC\OCS\Result
*/
public function getSubAdminsOfGroup($parameters) {
$group = $parameters['groupid'];
// Check group exists
$targetGroup = $this->groupManager->get($group);
if($targetGroup === null) {
- return new OC_OCS_Result(null, 101, 'Group does not exist');
+ return new \OC\OCS\Result(null, 101, 'Group does not exist');
}
$subadmins = $this->groupManager->getSubAdmin()->getGroupsSubAdmins($targetGroup);
@@ -177,7 +176,7 @@ class Groups{
$uids[] = $user->getUID();
}
- return new OC_OCS_Result($uids);
+ return new \OC\OCS\Result($uids);
}
}