Skip to content

Commit

Permalink
#139: improve how LastLogin is shown in users.md
Browse files Browse the repository at this point in the history
it gets updated on create & on update even without a login
  • Loading branch information
JoernBerkefeld committed Mar 23, 2023
1 parent af4afd6 commit 225f2a2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/metadataTypes/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ class User extends MetadataType {
.join(',<br> ');
}
const defaultBUName = this._getBuName(user.DefaultBusinessUnit);
const LastSuccessfulLogin = user.LastSuccessfulLogin.split('.')[0];
users.push({
TYPE: user.c__type,
UserID: user.UserID,
Expand All @@ -999,7 +1000,11 @@ class User extends MetadataType {
AssociatedBus: associatedBus,
Roles: roles,
LastSuccessfulLogin: user.LastSuccessfulLogin
? this._timeSinceDate(user.LastSuccessfulLogin)
? // on create & update, LastSuccessfulLogin often gets overwritten with the current date
LastSuccessfulLogin === user.CreatedDate.split('.')[0] ||
LastSuccessfulLogin === user.ModifiedDate.split('.')[0]
? 'unknown'
: this._timeSinceDate(user.LastSuccessfulLogin)
: 'never',
CreatedDate: user.CreatedDate ? user.CreatedDate.split('T').join(' ') : 'n/a',
ModifiedDate: user.ModifiedDate ? user.ModifiedDate.split('T').join(' ') : 'n/a',
Expand Down

0 comments on commit 225f2a2

Please sign in to comment.