Merge pull request #955 from ONLYOFFICE/feature/Change-UserInfoParser

Common.Utils.UserInfoParser -> AscCommon.UserInfoParser
This commit is contained in:
maxkadushkin 2021-07-01 19:41:14 +03:00 committed by GitHub
commit df7f0b5934
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 35 deletions

View file

@ -135,33 +135,8 @@ class ReviewChange extends Component {
this.onDeleteChange = this.onDeleteChange.bind(this);
this.appConfig = props.storeAppOptions;
if (this.appConfig && this.appConfig.canUseReviewPermissions) {
const permissions = this.appConfig.customization.reviewPermissions;
let arr = [];
const groups = Common.Utils.UserInfoParser.getParsedGroups(Common.Utils.UserInfoParser.getCurrentName());
groups && groups.forEach(function(group) {
const item = permissions[group.trim()];
item && (arr = arr.concat(item));
});
this.currentUserGroups = arr;
}
}
intersection (arr1, arr2) { //Computes the list of values that are the intersection of all the arrays.
const arr = [];
arr1.forEach((item1) => {
arr2.forEach((item2) => {
if (item1 === item2) {
arr.push(item2);
}
});
});
return arr;
}
checkUserGroups (username) {
const groups = Common.Utils.UserInfoParser.getParsedGroups(username);
return this.currentUserGroups && groups && (this.intersection(this.currentUserGroups, (groups.length>0) ? groups : [""]).length>0);
}
dateToLocaleTimeString (date) {
const format = (date) => {
let strTime,
@ -445,7 +420,7 @@ class ReviewChange extends Component {
const userColor = item.get_UserColor();
const goto = (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom);
date = this.dateToLocaleTimeString(date);
const editable = this.appConfig.isReviewOnly && (item.get_UserId() == this.appConfig.user.id) || !this.appConfig.isReviewOnly && (!this.appConfig.canUseReviewPermissions || this.checkUserGroups(item.get_UserName()));
const editable = this.appConfig.isReviewOnly && (item.get_UserId() == this.appConfig.user.id) || !this.appConfig.isReviewOnly && (!this.appConfig.canUseReviewPermissions || AscCommon.UserInfoParser.canEditReview(item.get_UserName()));
arr.push({date: date, user: user, userColor: userColor, changeText: changeText, goto: goto, editable: editable});
});
return arr;
@ -496,7 +471,7 @@ class ReviewChange extends Component {
change = {
date: arrChangeReview[0].date,
user: arrChangeReview[0].user,
userName: Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(arrChangeReview[0].user)),
userName: Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(arrChangeReview[0].user)),
color: arrChangeReview[0].userColor.get_hex(),
text: arrChangeReview[0].changeText,
initials: this.props.users.getInitials(arrChangeReview[0].user),

View file

@ -52,7 +52,7 @@ export class storeUsers {
}
getInitials (name) {
const fio = Common.Utils.UserInfoParser.getParsedName(name).split(' ');
const fio = AscCommon.UserInfoParser.getParsedName(name).split(' ');
let initials = fio[0].substring(0, 1).toUpperCase();
for (let i = fio.length-1; i>0; i--) {
if (fio[i][0]!=='(' && fio[i][0]!==')') {

View file

@ -36,7 +36,7 @@ class ContextMenu extends ContextMenuController {
getUserName(id) {
const user = this.props.users.searchUserByCurrentId(id);
return Common.Utils.UserInfoParser.getParsedName(user.asc_getUserName());
return AscCommon.UserInfoParser.getParsedName(user.asc_getUserName());
}
componentWillUnmount() {

View file

@ -54,7 +54,7 @@ class DocumentInfoController extends Component {
let valueModifiedBy = this.docProps.asc_getLastModifiedBy();
if (valueModifiedBy) {
return Common.Utils.UserInfoParser.getParsedName(valueModifiedBy);
return AscCommon.UserInfoParser.getParsedName(valueModifiedBy);
}
}

View file

@ -33,7 +33,7 @@ class ContextMenu extends ContextMenuController {
getUserName(id) {
const user = this.props.users.searchUserByCurrentId(id);
return Common.Utils.UserInfoParser.getParsedName(user.asc_getUserName());
return AscCommon.UserInfoParser.getParsedName(user.asc_getUserName());
}
componentWillUnmount() {

View file

@ -49,7 +49,7 @@ class PresentationInfoController extends Component {
let valueModifiedBy = this.docProps.asc_getLastModifiedBy();
if (valueModifiedBy) {
return Common.Utils.UserInfoParser.getParsedName(valueModifiedBy);
return AscCommon.UserInfoParser.getParsedName(valueModifiedBy);
}
}

View file

@ -34,7 +34,7 @@ class ContextMenu extends ContextMenuController {
getUserName(id) {
const user = this.props.users.searchUserByCurrentId(id);
return Common.Utils.UserInfoParser.getParsedName(user.asc_getUserName());
return AscCommon.UserInfoParser.getParsedName(user.asc_getUserName());
}
componentWillUnmount() {

View file

@ -57,7 +57,7 @@ class SpreadsheetInfoController extends Component {
getModifiedBy() {
let valueModifiedBy = this.docProps.asc_getLastModifiedBy();
if (valueModifiedBy) {
return Common.Utils.UserInfoParser.getParsedName(valueModifiedBy);
return AscCommon.UserInfoParser.getParsedName(valueModifiedBy);
}
return null;
}