From a8aab8d049f14790efe8381be287ac4139c1b382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 5 Dec 2017 11:02:46 +0100 Subject: [PATCH] Move to numeric acl types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #297 Signed-off-by: Julius Härtl --- js/controller/BoardController.js | 13 ++++++++++++- js/service/BoardService.js | 4 ++-- lib/Db/Acl.php | 28 ---------------------------- templates/part.board.sidebarView.php | 8 ++++---- 4 files changed, 18 insertions(+), 35 deletions(-) diff --git a/js/controller/BoardController.js b/js/controller/BoardController.js index 181008578..8927b012f 100644 --- a/js/controller/BoardController.js +++ b/js/controller/BoardController.js @@ -20,7 +20,7 @@ * */ -/** global: oc_defaults */ +/** global: oc_defaults, OC */ app.controller('BoardController', function ($rootScope, $scope, $stateParams, StatusService, BoardService, StackService, CardService, LabelService, $state, $transitions, $filter) { $scope.sidebar = $rootScope.sidebar; @@ -32,6 +32,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St $scope.newLabel = {}; $scope.status.boardtab = $stateParams.detailTab; + $scope.OC = OC; $scope.stackservice = StackService; $scope.boardservice = BoardService; $scope.cardservice = CardService; @@ -208,6 +209,16 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St BoardService.updateAcl(acl); }; + $scope.aclTypeString = function (acl) { + switch (acl.type) { + case OC.Share.SHARE_TYPE_USER: + return 'user'; + case OC.Share.SHARE_TYPE_GROUP: + return 'group'; + default: + return ''; + } + }; // settings for card sorting $scope.sortOptions = { diff --git a/js/service/BoardService.js b/js/service/BoardService.js index 97c421656..eaf1ed84f 100644 --- a/js/service/BoardService.js +++ b/js/service/BoardService.js @@ -82,7 +82,7 @@ app.factory('BoardService', function (ApiService, $http, $q) { // filter out everyone who is already in the share list angular.forEach(users, function (item) { - var acl = self.generateAcl('user', item); + var acl = self.generateAcl(OC.Share.SHARE_TYPE_USER, item); var exists = false; angular.forEach(self.getCurrent().acl, function (acl) { if (acl.participant.primaryKey === item.value.shareWith) { @@ -94,7 +94,7 @@ app.factory('BoardService', function (ApiService, $http, $q) { } }); angular.forEach(groups, function (item) { - var acl = self.generateAcl('group', item); + var acl = self.generateAcl(OC.Share.SHARE_TYPE_GROUP, item); var exists = false; angular.forEach(self.getCurrent().acl, function (acl) { if (acl.participant.primaryKey === item.value.shareWith) { diff --git a/lib/Db/Acl.php b/lib/Db/Acl.php index e4e282b41..b0b8cfc07 100644 --- a/lib/Db/Acl.php +++ b/lib/Db/Acl.php @@ -67,32 +67,4 @@ class Acl extends RelationalEntity { return false; } - public function jsonSerialize() { - $json = parent::jsonSerialize(); - $json['type'] = $this->getTypeString(); - return $json; - } - - public function getTypeString() { - if ($this->type === self::PERMISSION_TYPE_GROUP) { - return 'group'; - } - return 'user'; - } - - public function setType($type) { - if (is_numeric($type)) { - parent::setType($type); - return; - } - // FIXME: Remove when all javascript uses numeric types - if ($type === 'group' || $type === '1') { - $typeInt = self::PERMISSION_TYPE_GROUP; - } else { - $typeInt = self::PERMISSION_TYPE_USER; - } - $this->markFieldUpdated('type'); - $this->type = $typeInt; - } - } \ No newline at end of file diff --git a/templates/part.board.sidebarView.php b/templates/part.board.sidebarView.php index ab89efa03..b3e031eba 100644 --- a/templates/part.board.sidebarView.php +++ b/templates/part.board.sidebarView.php @@ -25,10 +25,10 @@ placeholder="t('Select users or groups to share with')); ?>" on-select="aclAdd(status.addSharee)" search-enabled="true"> - {{ $item.participant.displayname }} + {{ $item.participant.displayname }} - {{ sharee.participant.displayname }} + {{ sharee.participant.displayname }} t('No matching user or group found.')); ?> @@ -45,8 +45,8 @@
  • -
    -
    +
    +
    {{ acl.participant.displayname }}