Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-03-23 20:12:23 +0300
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-04-05 18:09:00 +0300
commit4011ea97b1a8553ecced4110f1d6d46268a52979 (patch)
treea5588d87e0ddd379daa44f74490744794238d524 /apps/provisioning_api/lib
parentf4e84e172752fb25898cbceddb7cbad4abde21d6 (diff)
Cast types directly
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/provisioning_api/lib')
-rw-r--r--apps/provisioning_api/lib/Controller/GroupsController.php36
1 files changed, 9 insertions, 27 deletions
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index c16c8266639..423313418a8 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -86,14 +86,7 @@ class GroupsController extends OCSController {
* @param int $offset
* @return DataResponse
*/
- public function getGroups(string $search = '', $limit = null, $offset = null): DataResponse {
- if ($limit !== null) {
- $limit = (int)$limit;
- }
- if ($offset !== null) {
- $offset = (int)$offset;
- }
-
+ public function getGroups(string $search = '', int $limit = null, int $offset = 0): DataResponse {
$groups = $this->groupManager->search($search, $limit, $offset);
$groups = array_map(function($group) {
/** @var IGroup $group */
@@ -113,14 +106,7 @@ class GroupsController extends OCSController {
* @param int $offset
* @return DataResponse
*/
- public function getGroupsDetails(string $search = '', $limit = null, $offset = null): DataResponse {
- if ($limit !== null) {
- $limit = (int)$limit;
- }
- if ($offset !== null) {
- $offset = (int)$offset;
- }
-
+ public function getGroupsDetails(string $search = '', int $limit = null, int $offset = null): DataResponse {
$groups = $this->groupManager->search($search, $limit, $offset);
$groups = array_map(function($group) {
/** @var IGroup $group */
@@ -154,16 +140,14 @@ class GroupsController extends OCSController {
*/
public function getGroupUsers(string $groupId): DataResponse {
$user = $this->userSession->getUser();
+ $isSubadminOfGroup = false;
// Check the group exists
- if(!$this->groupManager->groupExists($groupId)) {
- throw new OCSException('The requested group could not be found', \OCP\API::RESPOND_NOT_FOUND);
- }
-
- $isSubadminOfGroup = false;
$group = $this->groupManager->get($groupId);
if ($group !== null) {
$isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
+ } else {
+ throw new OCSException('The requested group could not be found', \OCP\API::RESPOND_NOT_FOUND);
}
// Check subadmin has access to this group
@@ -192,18 +176,16 @@ class GroupsController extends OCSController {
* @return DataResponse
* @throws OCSException
*/
- public function getGroupUsersDetails(string $groupId, $limit = null, $offset = 0): DataResponse {
+ public function getGroupUsersDetails(string $groupId, int $limit = null, int $offset = 0): DataResponse {
$user = $this->userSession->getUser();
+ $isSubadminOfGroup = false;
// Check the group exists
- if(!$this->groupManager->groupExists($groupId)) {
- throw new OCSException('The requested group could not be found', \OCP\API::RESPOND_NOT_FOUND);
- }
-
- $isSubadminOfGroup = false;
$group = $this->groupManager->get($groupId);
if ($group !== null) {
$isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
+ } else {
+ throw new OCSException('The requested group could not be found', \OCP\API::RESPOND_NOT_FOUND);
}
// Check subadmin has access to this group