From 220adf708fe214ba8a818c74ed70fea7918ac15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sun, 4 Feb 2018 12:24:37 +0100 Subject: [PATCH] Use actual acl list for assigning users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- js/service/BoardService.js | 23 +++++++++++++++++++++++ templates/part.card.php | 6 +++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/js/service/BoardService.js b/js/service/BoardService.js index 34c6d0eca..0da0ef185 100644 --- a/js/service/BoardService.js +++ b/js/service/BoardService.js @@ -141,6 +141,7 @@ app.factory('BoardService', function (ApiService, $http, $q) { board.acl = {}; } board.acl[response.data.id] = response.data; + self._updateUsers(); deferred.resolve(response.data); }, function (error) { deferred.reject('Error creating ACL ' + _acl); @@ -155,6 +156,7 @@ app.factory('BoardService', function (ApiService, $http, $q) { var self = this; $http.delete(this.baseUrl + '/' + acl.boardId + '/acl/' + acl.id).then(function (response) { delete board.acl[response.data.id]; + self._updateUsers(); deferred.resolve(response.data); }, function (error) { deferred.reject('Error deleting ACL ' + acl.id); @@ -170,6 +172,7 @@ app.factory('BoardService', function (ApiService, $http, $q) { var _acl = acl; $http.put(this.baseUrl + '/' + acl.boardId + '/acl', _acl).then(function (response) { board.acl[_acl.id] = response.data; + self._updateUsers(); deferred.resolve(response.data); }, function (error) { deferred.reject('Error updating ACL ' + _acl); @@ -178,6 +181,26 @@ app.factory('BoardService', function (ApiService, $http, $q) { return deferred.promise; }; + BoardService.prototype._updateUsers = function () { + if (!this.getCurrent() || !this.getCurrent().acl) { + return []; + } + var result = [this.getCurrent().owner]; + angular.forEach(this.getCurrent().acl, function(value, key) { + if (value.type === OC.Share.SHARE_TYPE_USER) { + result.push(value.participant); + } + }); + this.getCurrent()._users = result; + }; + + BoardService.prototype.getUsers = function () { + if (this.getCurrent() && !this.getCurrent()._users) { + this._updateUsers(); + } + return this.getCurrent()._users; + }; + BoardService.prototype.canRead = function () { if (!this.getCurrent() || !this.getCurrent().permissions) { return false; diff --git a/templates/part.card.php b/templates/part.card.php index cfbfcf862..c6f619739 100644 --- a/templates/part.card.php +++ b/templates/part.card.php @@ -61,10 +61,10 @@ {{ $item.participant.displayname }} - -
{{ user.displayname }} + +
{{ acl.displayname }}
- +