Add theme information to oputil user info

* Add theme ID
* Allow lookup by user ID
This commit is contained in:
Bryan Ashby 2020-11-18 13:22:22 -07:00
parent 51c9c7dc2d
commit 792acb0550
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
1 changed files with 9 additions and 0 deletions

View File

@ -30,6 +30,10 @@ function initAndGetUser(userName, cb) {
const User = require('../../core/user.js');
User.getUserIdAndName(userName, (err, userId) => {
if(err) {
// try user ID if number was supplied
if (_.isNumber(userName)) {
return User.getUser(parseInt(userName), callback);
}
return callback(err);
}
return User.getUser(userId, callback);
@ -329,12 +333,17 @@ function showUserInfo(user) {
return user.properties[p] || 'N/A';
};
const currentTheme = () => {
return user.properties[UserProps.ThemeId];
};
const stdInfo = `User information:
Username : ${user.username}${user.isRoot() ? ' (root/SysOp)' : ''}
Real name : ${propOrNA(UserProps.RealName)}
ID : ${user.userId}
Status : ${statusDesc()}
Groups : ${user.groups.join(', ')}
Theme ID : ${currentTheme()}
Created : ${created()}
Last login : ${lastLogin()}
Login count : ${propOrNA(UserProps.LoginCount)}