ApiRbacConfig
in package
RBAC gate modes for the Api layer, as two independent switches.
Values come from parameters.apiRbac.{mode,internalMode} in config/Shared/api.neon.
$modecontrols the external HTTP path, read in RbacCheckTrait::checkApiPermission() duringstartup().$internalModecontrols the internal path (ApiBridge), read in ApiPermissionGuardTrait::requireApiPermission() ininternalAction*().
Both accept the same values:
off: the gate does not run at all (no extra queries, no log lines).log: the gate evaluates and writesAPI_RBAC ...to theauthchannel, but denies nothing.enforce: a denial returns HTTP 403 (external) orResult::failure(PERMISSION_DENIED)(internal).
The switches are separate so that measuring the internal path cannot downgrade the external
one back to log, and so that either side can be rolled back alone. An internal denial breaks
the public website, an external one affects API clients only.
IMPORTANT: $mode does not control admin or front end, because startup() does not run on the
internal path. $internalMode controls exactly those, which is why its default is off.
IMPORTANT: both are compile-time parameters; after changing either, clear temp/cache,
otherwise the old value stays in effect.
Table of Contents
Constants
- MODE_ENFORCE : string = 'enforce'
- MODE_LOG : string = 'log'
- MODE_OFF : string = 'off'
- MODES : array<string|int, mixed> = [self::MODE_OFF, self::MODE_LOG, self::MODE_ENF...
Properties
- $internalMode : string
- Gate mode for the internal (bridge) path in `internalAction*()`.
- $mode : string
Methods
- __construct() : mixed
- isEnforce() : bool
- isInternalEnforce() : bool
- isInternalLog() : bool
- isInternalOff() : bool
- isLog() : bool
- isOff() : bool
- sanitize() : string
Constants
MODE_ENFORCE
public
string
MODE_ENFORCE
= 'enforce'
MODE_LOG
public
string
MODE_LOG
= 'log'
MODE_OFF
public
string
MODE_OFF
= 'off'
MODES
private
array<string|int, mixed>
MODES
= [self::MODE_OFF, self::MODE_LOG, self::MODE_ENFORCE]
Properties
$internalMode read-only
Gate mode for the internal (bridge) path in `internalAction*()`.
public
string
$internalMode
$mode read-only
public
string
$mode
Methods
__construct()
public
__construct([string $mode = self::MODE_LOG ][, string $internalMode = self::MODE_OFF ]) : mixed
Parameters
- $mode : string = self::MODE_LOG
- $internalMode : string = self::MODE_OFF
isEnforce()
public
isEnforce() : bool
Return values
boolisInternalEnforce()
public
isInternalEnforce() : bool
Return values
boolisInternalLog()
public
isInternalLog() : bool
Return values
boolisInternalOff()
public
isInternalOff() : bool
Return values
boolisLog()
public
isLog() : bool
Return values
boolisOff()
public
isOff() : bool
Return values
boolsanitize()
private
static sanitize(string $value, string $fallback, string $label) : string
Parameters
- $value : string
- $fallback : string
- $label : string