(js) Fix user removal from ACLs in Admin module

Fixes #3713
pull/212/head
Francis Lachapelle 2016-06-03 09:00:34 -04:00
parent 8395a78f6d
commit 717bab718c
3 changed files with 12 additions and 4 deletions

1
NEWS
View File

@ -3,6 +3,7 @@
Bug fixes Bug fixes
- [web] fixed error handling when renaming a mailbox - [web] fixed error handling when renaming a mailbox
- [web] fixed user removal from ACLs in Administration module (#3713)
3.1.1 (2016-06-02) 3.1.1 (2016-06-02)
------------------ ------------------

View File

@ -54,7 +54,7 @@
} }
function removeUser(user) { function removeUser(user) {
stateFolder.$acl.$removeUser(user.uid).catch(function(data, status) { stateFolder.$acl.$removeUser(user.uid, stateFolder.owner).catch(function(data, status) {
Dialog.alert(l('Warning'), l('An error occured please try again.')); Dialog.alert(l('Warning'), l('An error occured please try again.'));
}); });
} }

View File

@ -112,10 +112,17 @@
* @desc Remove a user from the folder's ACL * @desc Remove a user from the folder's ACL
* @return a promise of the server call to remove the user from the folder's ACL * @return a promise of the server call to remove the user from the folder's ACL
*/ */
Acl.prototype.$removeUser = function(uid) { Acl.prototype.$removeUser = function(uid, owner) {
var _this = this, var _this = this,
param = {uid: uid}; param = {uid: uid},
return Acl.$$resource.fetch(this.folderId, 'removeUserFromAcls', param).then(function() { acls;
if (angular.isDefined(owner))
acls = Acl.$$resource.userResource(owner).fetch(this.folderId, 'removeUserFromAcls', param);
else
acls = Acl.$$resource.fetch(this.folderId, 'removeUserFromAcls', param);
return acls.then(function() {
var i = _.indexOf(_.map(_this.users, 'uid'), uid); var i = _.indexOf(_.map(_this.users, 'uid'), uid);
if (i >= 0) { if (i >= 0) {
_this.users.splice(i, 1); _this.users.splice(i, 1);