mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-29 22:16:11 +02:00
ENiGMA 1/2 WILL USE SPACES FROM THIS POINT ON VS TABS
* Really just to make GitHub formatting happy. Arg.
This commit is contained in:
parent
5ddf04c882
commit
e9787cee3e
135 changed files with 27397 additions and 27397 deletions
124
core/acs.js
124
core/acs.js
|
@ -10,81 +10,81 @@ const assert = require('assert');
|
|||
const _ = require('lodash');
|
||||
|
||||
class ACS {
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
}
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
check(acs, scope, defaultAcs) {
|
||||
acs = acs ? acs[scope] : defaultAcs;
|
||||
acs = acs || defaultAcs;
|
||||
try {
|
||||
return checkAcs(acs, { client : this.client } );
|
||||
} catch(e) {
|
||||
Log.warn( { exception : e, acs : acs }, 'Exception caught checking ACS');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
check(acs, scope, defaultAcs) {
|
||||
acs = acs ? acs[scope] : defaultAcs;
|
||||
acs = acs || defaultAcs;
|
||||
try {
|
||||
return checkAcs(acs, { client : this.client } );
|
||||
} catch(e) {
|
||||
Log.warn( { exception : e, acs : acs }, 'Exception caught checking ACS');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Message Conferences & Areas
|
||||
//
|
||||
hasMessageConfRead(conf) {
|
||||
return this.check(conf.acs, 'read', ACS.Defaults.MessageConfRead);
|
||||
}
|
||||
//
|
||||
// Message Conferences & Areas
|
||||
//
|
||||
hasMessageConfRead(conf) {
|
||||
return this.check(conf.acs, 'read', ACS.Defaults.MessageConfRead);
|
||||
}
|
||||
|
||||
hasMessageAreaRead(area) {
|
||||
return this.check(area.acs, 'read', ACS.Defaults.MessageAreaRead);
|
||||
}
|
||||
hasMessageAreaRead(area) {
|
||||
return this.check(area.acs, 'read', ACS.Defaults.MessageAreaRead);
|
||||
}
|
||||
|
||||
//
|
||||
// File Base / Areas
|
||||
//
|
||||
hasFileAreaRead(area) {
|
||||
return this.check(area.acs, 'read', ACS.Defaults.FileAreaRead);
|
||||
}
|
||||
//
|
||||
// File Base / Areas
|
||||
//
|
||||
hasFileAreaRead(area) {
|
||||
return this.check(area.acs, 'read', ACS.Defaults.FileAreaRead);
|
||||
}
|
||||
|
||||
hasFileAreaWrite(area) {
|
||||
return this.check(area.acs, 'write', ACS.Defaults.FileAreaWrite);
|
||||
}
|
||||
hasFileAreaWrite(area) {
|
||||
return this.check(area.acs, 'write', ACS.Defaults.FileAreaWrite);
|
||||
}
|
||||
|
||||
hasFileAreaDownload(area) {
|
||||
return this.check(area.acs, 'download', ACS.Defaults.FileAreaDownload);
|
||||
}
|
||||
hasFileAreaDownload(area) {
|
||||
return this.check(area.acs, 'download', ACS.Defaults.FileAreaDownload);
|
||||
}
|
||||
|
||||
getConditionalValue(condArray, memberName) {
|
||||
if(!Array.isArray(condArray)) {
|
||||
// no cond array, just use the value
|
||||
return condArray;
|
||||
}
|
||||
getConditionalValue(condArray, memberName) {
|
||||
if(!Array.isArray(condArray)) {
|
||||
// no cond array, just use the value
|
||||
return condArray;
|
||||
}
|
||||
|
||||
assert(_.isString(memberName));
|
||||
assert(_.isString(memberName));
|
||||
|
||||
const matchCond = condArray.find( cond => {
|
||||
if(_.has(cond, 'acs')) {
|
||||
try {
|
||||
return checkAcs(cond.acs, { client : this.client } );
|
||||
} catch(e) {
|
||||
Log.warn( { exception : e, acs : cond }, 'Exception caught checking ACS');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true; // no acs check req.
|
||||
}
|
||||
});
|
||||
const matchCond = condArray.find( cond => {
|
||||
if(_.has(cond, 'acs')) {
|
||||
try {
|
||||
return checkAcs(cond.acs, { client : this.client } );
|
||||
} catch(e) {
|
||||
Log.warn( { exception : e, acs : cond }, 'Exception caught checking ACS');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true; // no acs check req.
|
||||
}
|
||||
});
|
||||
|
||||
if(matchCond) {
|
||||
return matchCond[memberName];
|
||||
}
|
||||
}
|
||||
if(matchCond) {
|
||||
return matchCond[memberName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ACS.Defaults = {
|
||||
MessageAreaRead : 'GM[users]',
|
||||
MessageConfRead : 'GM[users]',
|
||||
MessageAreaRead : 'GM[users]',
|
||||
MessageConfRead : 'GM[users]',
|
||||
|
||||
FileAreaRead : 'GM[users]',
|
||||
FileAreaWrite : 'GM[sysops]',
|
||||
FileAreaDownload : 'GM[users]',
|
||||
FileAreaRead : 'GM[users]',
|
||||
FileAreaWrite : 'GM[sysops]',
|
||||
FileAreaDownload : 'GM[users]',
|
||||
};
|
||||
|
||||
module.exports = ACS;
|
||||
module.exports = ACS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue