mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-19 10:08:12 +00:00
(js) Prohibit subscribing a user with no rights
This commit is contained in:
1 parent
dfcc14356a
commit
0e2c93864b
4 files changed
+28
-1
No files matched your search
@@ -145,6 +145,22 @@
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $hasNoRight
|
||||
* @memberof Acl.prototype
|
||||
* @desc Check if user has any rights on the resource
|
||||
* @return true if user has no right at all
|
||||
*/
|
||||
Acl.prototype.$hasNoRight = function(user) {
|
||||
var o = _.find(user.rights, function(value, right) {
|
||||
if (angular.isNumber(value))
|
||||
return (value === 1);
|
||||
else
|
||||
return (value !== 'None');
|
||||
});
|
||||
return _.isUndefined(o);
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $resetUsersRights
|
||||
* @memberof Acl.prototype
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
vm.addUser = addUser;
|
||||
vm.selectAllRights = selectAllRights;
|
||||
vm.selectUser = selectUser;
|
||||
vm.hasNoRight = hasNoRight;
|
||||
vm.showRights = showRights;
|
||||
vm.confirmation = { showing: false,
|
||||
message: ''};
|
||||
@@ -104,6 +105,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
function hasNoRight(user) {
|
||||
return folder.$acl.$hasNoRight(user);
|
||||
}
|
||||
|
||||
function showRights(user) {
|
||||
return vm.selectedUid == user.uid && !user.inactive;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user