summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Controller/GroupsController.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-07-24 07:44:09 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2017-07-24 11:42:07 +0200
commit6d4731024a18b7497dc19eefa97393eae7a3617b (patch)
treeef70dba744dcf8fa79574b07a7627771f1c7f62e /apps/provisioning_api/lib/Controller/GroupsController.php
parent989614f9d5faa11157b232785537eb5cca927649 (diff)
downloadnextcloud-server-6d4731024a18b7497dc19eefa97393eae7a3617b.tar.gz
nextcloud-server-6d4731024a18b7497dc19eefa97393eae7a3617b.zip
Some app fixes of phpstorm inspections
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/provisioning_api/lib/Controller/GroupsController.php')
-rw-r--r--apps/provisioning_api/lib/Controller/GroupsController.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index 2d329bf974b..e167c07582f 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -30,6 +30,7 @@ use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCSController;
use OCP\IGroup;
use OCP\IGroupManager;
+use OCP\ILogger;
use OCP\IRequest;
use OCP\IUserSession;
use OCP\IUser;
@@ -43,21 +44,27 @@ class GroupsController extends OCSController {
/** @var IUserSession */
private $userSession;
+ /** @var ILogger */
+ private $logger;
+
/**
* @param string $appName
* @param IRequest $request
* @param IGroupManager $groupManager
* @param IUserSession $userSession
+ * @param ILogger $logger
*/
public function __construct(
$appName,
IRequest $request,
IGroupManager $groupManager,
- IUserSession $userSession) {
+ IUserSession $userSession,
+ ILogger $logger) {
parent::__construct($appName, $request);
$this->groupManager = $groupManager;
$this->userSession = $userSession;
+ $this->logger = $logger;
}
/**
@@ -120,9 +127,9 @@ class GroupsController extends OCSController {
}, $users);
$users = array_values($users);
return new DataResponse(['users' => $users]);
- } else {
- throw new OCSException('User does not have access to specified group', \OCP\API::RESPOND_UNAUTHORISED);
}
+
+ throw new OCSException('User does not have access to specified group', \OCP\API::RESPOND_UNAUTHORISED);
}
/**
@@ -136,8 +143,8 @@ class GroupsController extends OCSController {
*/
public function addGroup($groupid) {
// Validate name
- if(empty($groupid)){
- \OCP\Util::writeLog('provisioning_api', 'Group name not supplied', \OCP\Util::ERROR);
+ if(empty($groupid)) {
+ $this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
throw new OCSException('Invalid group name', 101);
}
// Check if it exists
@@ -179,6 +186,7 @@ class GroupsController extends OCSController {
throw new OCSException('Group does not exist', 101);
}
+ /** @var IUser[] $subadmins */
$subadmins = $this->groupManager->getSubAdmin()->getGroupsSubAdmins($targetGroup);
// New class returns IUser[] so convert back
$uids = [];