Code cleanup & resolve some minor TODO's in dropfile gen

This commit is contained in:
Bryan Ashby 2018-12-09 01:01:55 -07:00
parent a8604ece54
commit 8652b35b46
3 changed files with 30 additions and 22 deletions

View file

@ -15,11 +15,12 @@ const Log = require('./logger.js').log;
const StatLog = require('./stat_log.js');
// deps
const crypto = require('crypto');
const assert = require('assert');
const async = require('async');
const _ = require('lodash');
const moment = require('moment');
const crypto = require('crypto');
const assert = require('assert');
const async = require('async');
const _ = require('lodash');
const moment = require('moment');
const sanatizeFilename = require('sanitize-filename');
exports.isRootUserId = function(id) { return 1 === id; };
@ -114,6 +115,11 @@ module.exports = class User {
return isMember;
}
getSanitizedName(type='username') {
const name = 'real' === type ? this.getProperty(UserProps.RealName) : this.username;
return sanatizeFilename(name) || `user${this.userId.toString()}`;
}
getLegacySecurityLevel() {
if(this.isRoot() || this.isGroupMember('sysops')) {
return 100;