Refactoring review permissions
This commit is contained in:
parent
5609945406
commit
7cc14b5f26
|
@ -464,7 +464,7 @@ define([
|
|||
scope : me.view,
|
||||
hint : !me.appConfig.canReview,
|
||||
goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom),
|
||||
editable : me.appConfig.isReviewOnly && (item.get_UserId() == me.currentUserId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || me.checkUserGroups(item.get_UserName()))
|
||||
editable : me.appConfig.isReviewOnly && (item.get_UserId() == me.currentUserId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || Common.Utils.UserInfoParser.canEditReview(item.get_UserName()))
|
||||
});
|
||||
|
||||
arr.push(change);
|
||||
|
@ -472,11 +472,6 @@ define([
|
|||
return arr;
|
||||
},
|
||||
|
||||
checkUserGroups: function(username) {
|
||||
var groups = Common.Utils.UserInfoParser.getParsedGroups(username);
|
||||
return Common.Utils.UserInfoParser.getCurrentGroups() && groups && (_.intersection(Common.Utils.UserInfoParser.getCurrentGroups(), (groups.length>0) ? groups : [""]).length>0);
|
||||
},
|
||||
|
||||
getUserName: function(id){
|
||||
if (this.userCollection && id!==null){
|
||||
var rec = this.userCollection.findUser(id);
|
||||
|
|
|
@ -1040,6 +1040,11 @@ Common.Utils.UserInfoParser = new(function() {
|
|||
|
||||
getCurrentGroups: function() {
|
||||
return usergroups;
|
||||
},
|
||||
|
||||
canEditReview: function(username) {
|
||||
var groups = this.getParsedGroups(username);
|
||||
return usergroups && groups && (_.intersection(usergroups, (groups.length>0) ? groups : [""]).length>0);
|
||||
}
|
||||
}
|
||||
})();
|
Loading…
Reference in a new issue