Skip to content

Commit

Permalink
(js) Fix user removal from ACLs in Admin module
Browse files Browse the repository at this point in the history
Fixes #3713
  • Loading branch information
cgx committed Jun 3, 2016
1 parent 8395a78 commit 717bab7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -3,6 +3,7 @@

Bug fixes
- [web] fixed error handling when renaming a mailbox
- [web] fixed user removal from ACLs in Administration module (#3713)

3.1.1 (2016-06-02)
------------------
Expand Down
Expand Up @@ -54,7 +54,7 @@
}

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.'));
});
}
Expand Down
13 changes: 10 additions & 3 deletions UI/WebServerResources/js/Common/Acl.service.js
Expand Up @@ -112,10 +112,17 @@
* @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
*/
Acl.prototype.$removeUser = function(uid) {
Acl.prototype.$removeUser = function(uid, owner) {
var _this = this,
param = {uid: uid};
return Acl.$$resource.fetch(this.folderId, 'removeUserFromAcls', param).then(function() {
param = {uid: uid},
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);
if (i >= 0) {
_this.users.splice(i, 1);
Expand Down

0 comments on commit 717bab7

Please sign in to comment.