This commit is contained in:
Bryan Ashby 2019-09-15 21:30:00 -06:00
parent afd6d4265f
commit 7783262af6
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
1 changed files with 23 additions and 9 deletions

View File

@ -14,6 +14,20 @@ class ACS {
this.subject = subject;
}
static get Defaults() {
return {
MessageConfRead : 'GM[users]', // list/read
MessageConfWrite : 'GM[users]', // post/write
MessageAreaRead : 'GM[users]', // list/read; requires parent conf read
MessageAreaWrite : 'GM[users]', // post/write; requires parent conf write
FileAreaRead : 'GM[users]', // list
FileAreaWrite : 'GM[sysops]', // upload
FileAreaDownload : 'GM[users]', // download
};
}
check(acs, scope, defaultAcs) {
acs = acs ? acs[scope] : defaultAcs;
acs = acs || defaultAcs;
@ -32,10 +46,18 @@ class ACS {
return this.check(conf.acs, 'read', ACS.Defaults.MessageConfRead);
}
hasMessageConfWrite(conf) {
return this.check(conf.acs, 'write', ACS.Defaults.MessageConfWrite);
}
hasMessageAreaRead(area) {
return this.check(area.acs, 'read', ACS.Defaults.MessageAreaRead);
}
hasMessageAreaWrite(area) {
return this.check(area.acs, 'write', ACS.Defaults.MessageAreaWrite);
}
//
// File Base / Areas
//
@ -44,6 +66,7 @@ class ACS {
}
hasFileAreaWrite(area) {
// :TODO: create 'upload' alias?
return this.check(area.acs, 'write', ACS.Defaults.FileAreaWrite);
}
@ -91,13 +114,4 @@ class ACS {
}
}
ACS.Defaults = {
MessageAreaRead : 'GM[users]',
MessageConfRead : 'GM[users]',
FileAreaRead : 'GM[users]',
FileAreaWrite : 'GM[sysops]',
FileAreaDownload : 'GM[users]',
};
module.exports = ACS;