Merge pull request #955 from ONLYOFFICE/feature/Change-UserInfoParser
Common.Utils.UserInfoParser -> AscCommon.UserInfoParser
This commit is contained in:
commit
df7f0b5934
|
@ -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),
|
||||
|
|
|
@ -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]!==')') {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue