Change api config: add user.group parameter used for customization.reviewPermissions (added as prefix).

Use nbsp separator for username prefix.
This commit is contained in:
Julia Radzhabova 2020-09-02 20:53:49 +03:00
parent cf35554730
commit be2924ef60
3 changed files with 15 additions and 30 deletions

View file

@ -70,7 +70,8 @@
user: { user: {
id: 'user id', id: 'user id',
name: 'user name' name: 'user name',
group: 'group name' // for customization.reviewPermissions parameter
}, },
recent: [ recent: [
{ {
@ -113,6 +114,11 @@
blank: true, blank: true,
requestClose: false // if true - goback send onRequestClose event instead opening url requestClose: false // if true - goback send onRequestClose event instead opening url
}, },
reviewPermissions: {
"Group1": ["Group2"], // users from Group1 can accept/reject review changes made by users from Group2
"Group2": ["Group1", "Group2"] // users from Group2 can accept/reject review changes made by users from Group1 and Group2
"Group3": [""] // users from Group3 can accept/reject review changes made by users without a group
},
chat: true, chat: true,
comments: true, comments: true,
zoom: 100, zoom: 100,

View file

@ -712,6 +712,7 @@ Common.Utils.fillUserInfo = function(info, lang, defname) {
var _user = info || {}; var _user = info || {};
!_user.id && (_user.id = ('uid-' + Date.now())); !_user.id && (_user.id = ('uid-' + Date.now()));
_user.fullname = _.isEmpty(_user.name) ? defname : _user.name; _user.fullname = _.isEmpty(_user.name) ? defname : _user.name;
_user.group && (_user.fullname = (_user.group).toString() + Common.Utils.UserInfoParser.getSeparator() + _user.fullname);
return _user; return _user;
}; };
@ -963,21 +964,26 @@ Common.Utils.ModalWindow = new(function() {
Common.Utils.UserInfoParser = new(function() { Common.Utils.UserInfoParser = new(function() {
var parse = false; var parse = false;
var separator = String.fromCharCode(160);
return { return {
setParser: function(value) { setParser: function(value) {
parse = !!value; parse = !!value;
}, },
getSeparator: function() {
return separator;
},
getParsedName: function(username) { getParsedName: function(username) {
if (parse && username) { if (parse && username) {
return username.substring(username.indexOf(':')+1); return username.substring(username.indexOf(separator)+1);
} else } else
return username; return username;
}, },
getParsedGroups: function(username) { getParsedGroups: function(username) {
if (parse && username) { if (parse && username) {
var idx = username.indexOf(':'), var idx = username.indexOf(separator),
groups = (idx>-1) ? username.substring(0, idx).split(',') : []; groups = (idx>-1) ? username.substring(0, idx).split(',') : [];
for (var i=0; i<groups.length; i++) for (var i=0; i<groups.length; i++)
groups[i] = groups[i].trim(); groups[i] = groups[i].trim();

View file

@ -127,31 +127,4 @@ define([
}, 500); }, 500);
} }
}; };
Common.Utils.UserInfoParser = new(function() {
var parse = false;
return {
setParser: function(value) {
parse = !!value;
},
getParsedName: function(username) {
if (parse && username) {
return username.substring(username.indexOf(':')+1);
} else
return username;
},
getParsedGroups: function(username) {
if (parse && username) {
var idx = username.indexOf(':'),
groups = (idx>-1) ? username.substring(0, idx).split(',') : [];
for (var i=0; i<groups.length; i++)
groups[i] = groups[i].trim();
return groups;
} else
return undefined;
}
}
})();
}); });