New ACS for ActivtiyPub enabled check
This commit is contained in:
parent
a968f21957
commit
65e5fa1b77
|
@ -937,6 +937,7 @@ function peg$parse(input, options) {
|
|||
const Log = require('./logger.js').log;
|
||||
const User = require('./user.js');
|
||||
const Config = require('./config.js').get;
|
||||
const ActivityPubSettings = require('./activitypub/settings');
|
||||
|
||||
const _ = require('lodash');
|
||||
const moment = require('moment');
|
||||
|
@ -947,6 +948,17 @@ function peg$parse(input, options) {
|
|||
function checkAccess(acsCode, value) {
|
||||
try {
|
||||
return {
|
||||
AE: function activityPubEnabled() {
|
||||
const apSettings = ActivityPubSettings.fromUser(user);
|
||||
switch (value) {
|
||||
case 0:
|
||||
return !apSettings.enabled;
|
||||
case 1:
|
||||
return apSettings.enabled;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
SE: function servicesEnabled() {
|
||||
if (!Array.isArray(value)) {
|
||||
value = [value];
|
||||
|
|
|
@ -51,6 +51,7 @@ The following are ACS codes available as of this writing:
|
|||
| AR<i>authFactorReq</i> | Current user **requires** an Authentication Factor >= _authFactorReq_ |
|
||||
| PV[_name,_value_] | Checks that the property by _name_ for the current user is exactly _value_. This ACS allows arbitrary user property values to be checked. For example, `PV[message_conf,local]` checks that the user is currently in the "local" message conference.
|
||||
| SE[_service_,_service_,...] | Checks that all services listed by _service_ listed are enabled. Available services: `http`, `https`, `web` (`http` or `https`), `gopher`, `nntp`, `nntps`, `activitypub` (requires `web`), `nodeinfo2` (requires `web`), `webfinger` (requires `web`). Example: `SE[activitypub]`.
|
||||
| AE<i>enabled</i> | ActivityPub is _enabled_: 1=true, 0=false |
|
||||
|
||||
## ACS Strings
|
||||
ACS strings are one or more ACS codes in addition to some basic language semantics.
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
const Log = require('./logger.js').log;
|
||||
const User = require('./user.js');
|
||||
const Config = require('./config.js').get;
|
||||
const ActivityPubSettings = require('./activitypub/settings');
|
||||
|
||||
const _ = require('lodash');
|
||||
const moment = require('moment');
|
||||
|
@ -14,6 +15,14 @@
|
|||
function checkAccess(acsCode, value) {
|
||||
try {
|
||||
return {
|
||||
AE : function activityPubEnabled() {
|
||||
const apSettings = ActivityPubSettings.fromUser(user);
|
||||
switch(value) {
|
||||
case 0 : return !apSettings.enabled;
|
||||
case 1 : return apSettings.enabled;
|
||||
default : return false;
|
||||
}
|
||||
},
|
||||
SE : function servicesEnabled() {
|
||||
if (!Array.isArray(value)) {
|
||||
value = [ value];
|
||||
|
|
Loading…
Reference in New Issue