Refactoring review permissions

This commit is contained in:
Julia Radzhabova 2021-03-16 13:46:44 +03:00
parent 5609945406
commit 7cc14b5f26
2 changed files with 6 additions and 6 deletions

View file

@ -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);

View file

@ -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);
}
}
})();