nuxeo-development-framework 5.6.2 → 5.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1308,8 +1308,7 @@
1308
1308
  }(Nuxeo));
1309
1309
 
1310
1310
  var RolesService = /** @class */ (function () {
1311
- function RolesService(environment
1312
- // , private globalAdmin : GlobalAdminService , private nuxeoService : NuxeoService
1311
+ function RolesService(environment // , private globalAdmin : GlobalAdminService , private nuxeoService : NuxeoService
1313
1312
  ) {
1314
1313
  this.environment = environment;
1315
1314
  }
@@ -1362,14 +1361,20 @@
1362
1361
  }
1363
1362
  return hasRole;
1364
1363
  };
1365
- RolesService.prototype.getUserRoleName = function (user, code) {
1364
+ RolesService.prototype.getUserRoleName = function (user, code, roleIncludes) {
1366
1365
  var _this = this;
1366
+ if (roleIncludes === void 0) { roleIncludes = "dms_user_"; }
1367
+ var _a;
1367
1368
  var found = null;
1368
- var groups = user ? user.extendedGroups || user.groups : [];
1369
+ var groups = user
1370
+ ? user.extendedGroups && ((_a = user.extendedGroups) === null || _a === void 0 ? void 0 : _a.length) > 0
1371
+ ? user.extendedGroups
1372
+ : user.groups || []
1373
+ : [];
1369
1374
  if (groups && groups.length) {
1370
1375
  Object.keys(this.environment.RolesConstants).forEach(function (key) {
1371
1376
  var roleWCode = _this.environment.RolesConstants[key].replace("{departmentTitle}", code);
1372
- if ((code && roleWCode.includes('dms_user_')) || !code)
1377
+ if ((code && roleWCode.includes(roleIncludes)) || !code)
1373
1378
  groups.forEach(function (group) {
1374
1379
  if (group.name || group === roleWCode) {
1375
1380
  found = key;