diff --git a/core/acs_parser.js b/core/acs_parser.js index d203fc0e..df8605fd 100644 --- a/core/acs_parser.js +++ b/core/acs_parser.js @@ -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]; diff --git a/docs/_docs/configuration/acs.md b/docs/_docs/configuration/acs.md index 4e485770..d6014bda 100644 --- a/docs/_docs/configuration/acs.md +++ b/docs/_docs/configuration/acs.md @@ -51,6 +51,7 @@ The following are ACS codes available as of this writing: | ARauthFactorReq | 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]`. +| AEenabled | ActivityPub is _enabled_: 1=true, 0=false | ## ACS Strings ACS strings are one or more ACS codes in addition to some basic language semantics. diff --git a/misc/acs_parser.pegjs b/misc/acs_parser.pegjs index 1eecafd7..e17cba26 100644 --- a/misc/acs_parser.pegjs +++ b/misc/acs_parser.pegjs @@ -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];