From 792acb0550b2be9a0841f4ecedbf3301647545f6 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 18 Nov 2020 13:22:22 -0700 Subject: [PATCH] Add theme information to oputil user info * Add theme ID * Allow lookup by user ID --- core/oputil/oputil_user.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/oputil/oputil_user.js b/core/oputil/oputil_user.js index e3501d13..403c5076 100644 --- a/core/oputil/oputil_user.js +++ b/core/oputil/oputil_user.js @@ -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)}