Skip to content

Commit

Permalink
#139: fix document user for AccountUserID & BU Access columns
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Mar 21, 2023
1 parent 75f7fea commit 2e5390b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/metadataTypes/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,19 +775,17 @@ class User extends MetadataType {
.join(', ');
}
// user roles
// TODO think about what to do with "individual role" entries
let roles = '';
if (user.c__RoleNamesGlobal) {
roles = '<nobr>' + user.c__RoleNamesGlobal.join(',</nobr><br> <nobr>') + '</nobr>';
}
let associatedBus = '';
if (user.c__AssociatedBusinessUnits) {
user.c__AssociatedBusinessUnits.push({ ID: user.DefaultBusinessUnit });
// ensure Parent BU is first in list
user.c__AssociatedBusinessUnits.push(user.DefaultBusinessUnit);
// ensure associatedBus have no duplicates
associatedBus = [
...new Set(
user.c__AssociatedBusinessUnits.map((item) => this._getBuName(item.ID))
),
...new Set(user.c__AssociatedBusinessUnits.map((mid) => this._getBuName(mid))),
]
.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))
.join(',<br> ');
Expand All @@ -796,7 +794,7 @@ class User extends MetadataType {
users.push({
TYPE: user.c__type,
UserID: user.UserID,
AccountUserID: user.AccountUserID,
AccountUserID: user.AccountUserID || '-',
CustomerKey: user.CustomerKey,
Name: user.Name,
Email: user.Email,
Expand All @@ -805,7 +803,7 @@ class User extends MetadataType {
IsAPIUser: user.IsAPIUser === true ? '✓' : '-',
MustChangePassword: user.MustChangePassword === true ? '✓' : '-',
DefaultBusinessUnit: defaultBUName,
c__AssociatedBusinessUnits: associatedBus,
AssociatedBus: associatedBus,
Roles: roles,
UserPermissions: userPermissions,
LastSuccessfulLogin: user.LastSuccessfulLogin
Expand All @@ -823,7 +821,7 @@ class User extends MetadataType {
['API User', 'IsAPIUser'],
['Must change PW', 'MustChangePassword'],
['Default BU', 'DefaultBusinessUnit'],
['BU Access', 'c__AssociatedBusinessUnits'],
['BU Access', 'AssociatedBus'],
['Roles', 'Roles'],
['User Permissions', 'UserPermissions'],
['Login', 'UserID'],
Expand Down

0 comments on commit 2e5390b

Please sign in to comment.