diff --git a/js/controller/ListController.js b/js/controller/ListController.js index 6f2a0205f..c88d43226 100644 --- a/js/controller/ListController.js +++ b/js/controller/ListController.js @@ -65,9 +65,16 @@ var ListController = function ($scope, $location, $filter, BoardService, $elemen $scope.groupLimitDisabled = true; let fetchGroups = function () { var deferred = $q.defer(); - $http.get(OC.linkToOCS('cloud', 2) + 'groups/details').then(function (response) { - $scope.groups = response.data.ocs.data.groups; - deferred.resolve(response.data.ocs.data.groups); + // TODO: move to groups/details once 15 is min version + $http.get(OC.linkToOCS('cloud', 2) + 'groups').then(function (response) { + $scope.groups = response.data.ocs.data.groups.reduce((obj, item) => { + obj.push({ + id: item, + displayname: item, + }); + return obj; + }, []); + deferred.resolve($scope.groups); }, function (error) { deferred.reject('Error while loading groups'); }); diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index 98390fd58..539c19e79 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -106,10 +106,6 @@ private function getGroupLimit() { return [ 'id' => $group->getGID(), 'displayname' => $group->getDisplayName(), - 'usercount' => $group->count(), - 'disabled' => $group->countDisabled(), - 'canAdd' => $group->canAddUser(), - 'canRemove' => $group->canRemoveUser(), ]; }, $groups); return $groups; diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 4cb9f79e6..0842ef14b 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -68,7 +68,9 @@ public function index() { ]; if ($this->defaultBoardService->checkFirstRun($this->userId, $this->appName)) { - $this->defaultBoardService->createDefaultBoard($this->l10n->t('Personal'), $this->userId, '000000'); + if ($this->permissionService->canCreate()) { + $this->defaultBoardService->createDefaultBoard($this->l10n->t('Personal'), $this->userId, '000000'); + } } return new TemplateResponse('deck', 'main', $params); diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php index 0f2038ee6..8f6d1c47c 100644 --- a/tests/unit/controller/PageControllerTest.php +++ b/tests/unit/controller/PageControllerTest.php @@ -65,6 +65,10 @@ public function testIndexOnFirstRun() { ->method('checkFirstRun') ->willReturn(true); + $this->permissionService->expects($this->any()) + ->method('canCreate') + ->willReturn(true); + $this->defaultBoardService->expects($this->once()) ->method('createDefaultBoard') ->willReturn($board); @@ -73,6 +77,29 @@ public function testIndexOnFirstRun() { $this->assertEquals('main', $response->getTemplateName()); } + public function testIndexOnFirstRunNoCreate() { + + $board = new Board(); + $board->setTitle('Personal'); + $board->setOwner($this->userId); + $board->setColor('000000'); + + $this->defaultBoardService->expects($this->once()) + ->method('checkFirstRun') + ->willReturn(true); + + $this->permissionService->expects($this->any()) + ->method('canCreate') + ->willReturn(false); + + $this->defaultBoardService->expects($this->never()) + ->method('createDefaultBoard') + ->willReturn($board); + + $response = $this->controller->index(); + $this->assertEquals('main', $response->getTemplateName()); + } + public function testIndexOnSecondRun() { $this->config->setUserValue($this->userId, 'deck', 'firstRun', 'no');