Add userInfo permissions: hide users not in permissions.userInfo groups

This commit is contained in:
Julia Radzhabova 2022-02-09 17:48:26 +03:00
parent 2c6fd0f3ca
commit 82fec34f74
7 changed files with 13 additions and 0 deletions

View file

@ -56,6 +56,7 @@
edit: ["Group1", ""] // current user can edit comments made by users from Group1 and users without a group.
remove: ["Group1", ""] // current user can remove comments made by users from Group1 and users without a group.
},
userInfo: ["Group1", ""], // show tooltips/cursors/info in header only for users in userInfo groups. [""] - means users without group, [] - don't show any users, null/undefined/"" - show all users
protect: <can protect document> // default = true. show/hide protect tab or protect buttons
}
},

View file

@ -1481,10 +1481,12 @@ define([
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroups ||
this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'));
this.appOptions.canUseCommentPermissions = this.appOptions.canLicense && !!this.permissions.commentGroups;
this.appOptions.canUseUserInfoPermissions = this.appOptions.canLicense && !!this.permissions.userInfo;
AscCommon.UserInfoParser.setParser(true);
AscCommon.UserInfoParser.setCurrentName(this.appOptions.user.fullname);
this.appOptions.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions);
this.appOptions.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(this.permissions.commentGroups);
this.appOptions.canUseUserInfoPermissions && AscCommon.UserInfoParser.setUserInfoPermissions(this.permissions.userInfo);
appHeader.setUserName(AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName()));
this.appOptions.canRename && appHeader.setCanRename(true);

View file

@ -141,8 +141,10 @@ export class storeAppOptions {
this.canUseReviewPermissions = this.canLicense && (!!permissions.reviewGroups || this.customization
&& this.customization.reviewPermissions && (typeof (this.customization.reviewPermissions) == 'object'));
this.canUseCommentPermissions = this.canLicense && !!permissions.commentGroups;
this.canUseUserInfoPermissions = this.canLicense && !!permissions.userInfo;
this.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(permissions.reviewGroups, this.customization.reviewPermissions);
this.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(permissions.commentGroups);
this.canUseUserInfoPermissions && AscCommon.UserInfoParser.setUserInfoPermissions(permissions.userInfo);
}
setCanViewReview (value) {
this.canViewReview = value;

View file

@ -1153,10 +1153,12 @@ define([
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroups ||
this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'));
this.appOptions.canUseCommentPermissions = this.appOptions.canLicense && !!this.permissions.commentGroups;
this.appOptions.canUseUserInfoPermissions = this.appOptions.canLicense && !!this.permissions.userInfo;
AscCommon.UserInfoParser.setParser(true);
AscCommon.UserInfoParser.setCurrentName(this.appOptions.user.fullname);
this.appOptions.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions);
this.appOptions.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(this.permissions.commentGroups);
this.appOptions.canUseUserInfoPermissions && AscCommon.UserInfoParser.setUserInfoPermissions(this.permissions.userInfo);
appHeader.setUserName(AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName()));
this.appOptions.canRename && appHeader.setCanRename(true);

View file

@ -112,7 +112,9 @@ export class storeAppOptions {
this.canUseReviewPermissions = this.canLicense && (!!permissions.reviewGroups || this.customization
&& this.customization.reviewPermissions && (typeof (this.customization.reviewPermissions) == 'object'));
this.canUseCommentPermissions = this.canLicense && !!permissions.commentGroups;
this.canUseUserInfoPermissions = this.canLicense && !!permissions.userInfo;
this.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(permissions.reviewGroups, this.customization.reviewPermissions);
this.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(permissions.commentGroups);
this.canUseUserInfoPermissions && AscCommon.UserInfoParser.setUserInfoPermissions(permissions.userInfo);
}
}

View file

@ -1230,10 +1230,12 @@ define([
this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && (!!this.permissions.reviewGroups ||
this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'));
this.appOptions.canUseCommentPermissions = this.appOptions.canLicense && !!this.permissions.commentGroups;
this.appOptions.canUseUserInfoPermissions = this.appOptions.canLicense && !!this.permissions.userInfo;
AscCommon.UserInfoParser.setParser(true);
AscCommon.UserInfoParser.setCurrentName(this.appOptions.user.fullname);
this.appOptions.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(this.permissions.reviewGroups, this.editorConfig.customization.reviewPermissions);
this.appOptions.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(this.permissions.commentGroups);
this.appOptions.canUseUserInfoPermissions && AscCommon.UserInfoParser.setUserInfoPermissions(this.permissions.userInfo);
this.headerView.setUserName(AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName()));
} else
this.appOptions.canModifyFilter = true;

View file

@ -107,7 +107,9 @@ export class storeAppOptions {
this.canUseReviewPermissions = this.canLicense && (!!permissions.reviewGroups || this.customization
&& this.customization.reviewPermissions && (typeof (this.customization.reviewPermissions) == 'object'));
this.canUseCommentPermissions = this.canLicense && !!permissions.commentGroups;
this.canUseUserInfoPermissions = this.canLicense && !!permissions.userInfo;
this.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(permissions.reviewGroups, this.customization.reviewPermissions);
this.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(permissions.commentGroups);
this.canUseUserInfoPermissions && AscCommon.UserInfoParser.setUserInfoPermissions(permissions.userInfo);
}
}