Use actual acl list for assigning users
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -61,10 +61,10 @@
|
||||
<ui-select-match placeholder="<?php p($l->t('Assign this card to a user')); ?>">
|
||||
<span><i class="icon icon-{{$item.type}}"></i> {{ $item.participant.displayname }}</span>
|
||||
</ui-select-match>
|
||||
<ui-select-choices repeat="user in boardservice.getCurrent().users | filter: $select.search | withoutAssignedUsers: cardservice.getCurrent().assignedUsers track by user.uid">
|
||||
<div class="avatardiv" avatar ng-attr-user="{{ user.uid }}" ng-attr-displayname="{{ user.displayname }}" ng-if="boardservice.id"></div><span>{{ user.displayname }}</span>
|
||||
<ui-select-choices repeat="acl in boardservice.getUsers() | filter: $select.search | withoutAssignedUsers: cardservice.getCurrent().assignedUsers track by acl.uid">
|
||||
<div class="avatardiv" avatar ng-attr-user="{{ acl.uid }}" ng-attr-displayname="{{ acl.displayname }}" ng-if="boardservice.id"></div><span>{{ acl.displayname }}</span>
|
||||
</ui-select-choices>
|
||||
</ui-select>
|
||||
</ui-select>
|
||||
<div class="card-details-assign-users-list">
|
||||
<div class="assigned-user" ng-repeat="user in cardservice.getCurrent().assignedUsers track by user.uid">
|
||||
<avatar ng-attr-contactsmenu ng-attr-tooltip ng-attr-user="{{ user.participant.uid }}" ng-attr-displayname="{{ user.participant.displayname }}" contactsmenudelete ></avatar>
|
||||
|
||||
Reference in New Issue
Block a user