Change review permissions: deprecate customization.reviewPermissions parameter. Use permissions.reviewGroup instead: list of groups, that current user can accept/reject.

This commit is contained in:
Julia Radzhabova 2021-02-05 13:51:37 +03:00
parent 310c00b245
commit f17b8d1c76
8 changed files with 33 additions and 21 deletions

View file

@ -49,7 +49,8 @@
fillForms: <can edit forms in view mode> // default = edit || review,
copy: <can copy data> // default = true,
editCommentAuthorOnly: <can edit your own comments only> // default = false
deleteCommentAuthorOnly: <can delete your own comments only> // default = false
deleteCommentAuthorOnly: <can delete your own comments only> // default = false,
reviewGroup: ["Group1", ""] // current user can accept/reject review changes made by users from Group1 and users without a group. [] - use groups, but can't change any group's changes
}
},
editorConfig: {

View file

@ -972,7 +972,8 @@ Common.Utils.UserInfoParser = new(function() {
separator = String.fromCharCode(160),
username = '',
usergroups,
permissions;
reviewPermissions,
reviewGroups;
return {
setParser: function(value) {
parse = !!value;
@ -1002,23 +1003,27 @@ Common.Utils.UserInfoParser = new(function() {
setCurrentName: function(name) {
username = name;
this.setReviewPermissions(permissions);
this.setReviewPermissions(reviewGroups, reviewPermissions);
},
getCurrentName: function() {
return username;
},
setReviewPermissions: function(reviewPermissions) {
if (reviewPermissions) {
setReviewPermissions: function(groups, permissions) {
if (groups) {
if (typeof groups == 'object' && groups.length>0)
usergroups = groups;
reviewGroups = groups;
} else if (permissions) {
var arr = [],
groups = this.getParsedGroups(username);
groups && groups.forEach(function(group) {
var item = reviewPermissions[group.trim()];
arrgroups = this.getParsedGroups(username);
arrgroups && arrgroups.forEach(function(group) {
var item = permissions[group.trim()];
item && (arr = arr.concat(item));
});
usergroups = arr;
permissions = reviewPermissions;
reviewPermissions = permissions;
}
},

View file

@ -1319,10 +1319,11 @@ define([
this.appOptions.canFavorite = this.document.info && (this.document.info.favorite!==undefined && this.document.info.favorite!==null) && !this.appOptions.isOffline;
this.appOptions.canFavorite && appHeader.setFavorite(this.document.info.favorite);
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object');
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroup ||
this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'));
Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);
Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname);
this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.editorConfig.customization.reviewPermissions);
this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.permissions.reviewGroup, this.editorConfig.customization.reviewPermissions);
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName()));
this.appOptions.canRename && appHeader.setCanRename(true);

View file

@ -837,10 +837,11 @@ define([
me.appOptions.canUseHistory = me.appOptions.canReview = me.appOptions.isReviewOnly = false;
}
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object');
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && (!!me.permissions.reviewGroup ||
me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object'));
Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions);
Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname);
me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.editorConfig.customization.reviewPermissions);
me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.permissions.reviewGroup, me.editorConfig.customization.reviewPermissions);
me.applyModeCommonElements();
me.applyModeEditorElements();

View file

@ -1025,10 +1025,11 @@ define([
this.appOptions.canFavorite = this.document.info && (this.document.info.favorite!==undefined && this.document.info.favorite!==null) && !this.appOptions.isOffline;
this.appOptions.canFavorite && appHeader.setFavorite(this.document.info.favorite);
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object');
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroup ||
this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'));
Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);
Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname);
this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.editorConfig.customization.reviewPermissions);
this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.permissions.reviewGroup, this.editorConfig.customization.reviewPermissions);
appHeader.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName()));
this.appOptions.canRename && appHeader.setCanRename(true);

View file

@ -755,10 +755,11 @@ define([
me.appOptions.canBranding = params.asc_getCustomization();
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object');
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && (!!me.permissions.reviewGroup ||
me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object'));
Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions);
Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname);
me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.editorConfig.customization.reviewPermissions);
me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.permissions.reviewGroup, me.editorConfig.customization.reviewPermissions);
me.applyModeCommonElements();
me.applyModeEditorElements();

View file

@ -1070,10 +1070,11 @@ define([
this.appOptions.canFavorite && this.headerView && this.headerView.setFavorite(this.appOptions.spreadsheet.info.favorite);
this.appOptions.canRename && this.headerView.setCanRename(true);
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object');
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroup ||
this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'));
Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions);
Common.Utils.UserInfoParser.setCurrentName(this.appOptions.user.fullname);
this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.editorConfig.customization.reviewPermissions);
this.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(this.permissions.reviewGroup, this.editorConfig.customization.reviewPermissions);
this.headerView.setUserName(Common.Utils.UserInfoParser.getParsedName(Common.Utils.UserInfoParser.getCurrentName()));
} else
this.appOptions.canModifyFilter = true;

View file

@ -766,10 +766,11 @@ define([
me.appOptions.canBranding = params.asc_getCustomization();
me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object');
me.appOptions.canUseReviewPermissions = me.appOptions.canLicense && (!!me.permissions.reviewGroup ||
me.editorConfig.customization && me.editorConfig.customization.reviewPermissions && (typeof (me.editorConfig.customization.reviewPermissions) == 'object'));
Common.Utils.UserInfoParser.setParser(me.appOptions.canUseReviewPermissions);
Common.Utils.UserInfoParser.setCurrentName(me.appOptions.user.fullname);
me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.editorConfig.customization.reviewPermissions);
me.appOptions.canUseReviewPermissions && Common.Utils.UserInfoParser.setReviewPermissions(me.permissions.reviewGroup, me.editorConfig.customization.reviewPermissions);
}
me.appOptions.canRequestEditRights = me.editorConfig.canRequestEditRights;