Charter · API

verifyCharter

Validates a charter against the ids of each section and returns a report with errors and warnings. It takes every existing id per section, because a pattern can only be checked against the ids that exist. Run it at boot, before any user signs in, and stop the boot if it reports errors.

Charter
{
  member: ['programme', 'seats', 'me.*'],
  manager: { allow: ['*'], deny: ['me.*', 'cloakroom'] },
}
Action ids
[
  'welcome',
  'programme',
  'seats',
  'me.tickets',
  'me.pass',
  'door.list',
  'members',
  'takings',
  'settings',
]
Errors and warning count
{
  errors: [
    {
      rule: 'dead-deny',
      detail: 'role "manager" denies "cloakroom" (actions) which matches nothing — silent means unprotected',
    },
  ],
  warnings: 0,
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.