testing/cross_backend/test_room_authorize.ts

Test RoomAuthorize policy mounted on both reference spines — the TS spine binary's full mount (full_spine_mount.ts) and the Rust testing_spine_stub — so the rooms_ws cross suite drives the room verbs with one rule set on both. The twin of the Rust TestRoomAuthorize, rule for rule.

The room id's prefix decides, so a case picks its rule by naming its room:

  • open:<rest> — join and watch, no scope, the registry's cap;
  • scoped:<scope>:<rest> — join and watch under the scope <scope> (non-empty);
  • pair:<rest> — join and watch, at most two members;
  • watch:<rest> — watch only; a join is denied;
  • admin:<rest> — join and watch for an actor holding the global admin role, denied to anyone else;
  • anything else — denied (room_not_found).

A test policy, not a model. The admin: rule reads the grant live through the request's database, inside the reserve window, as every authorizer must (RoomAuthorize); no other rule reads the database. A cross-language test contract.

view source

Declarations
#

3 declarations

test_room_authorize
#

test_room_rule_reads_admin
#

testing/cross_backend/test_room_authorize.ts view source

(room_id: string): boolean import {test_room_rule_reads_admin} from '@fuzdev/fuz_app/testing/cross_backend/test_room_authorize.js';

Whether room_id's rule reads the actor's global admin grant.

room_id

the room the request names

type string

returns

boolean

true for an admin: room

test_room_verdict
#

testing/cross_backend/test_room_authorize.ts view source

(room_id: string, access: RoomAccess, holds_admin: boolean): RoomVerdict import {test_room_verdict} from '@fuzdev/fuz_app/testing/cross_backend/test_room_authorize.js';

The verdict for room_id, as the module doc lists — pure, so the rule table is checked without a database. Twin of the Rust TestRoomAuthorize::verdict.

room_id

the room the request names

type string

access

join or watch

holds_admin

the live read, consulted only by the admin: rule

type boolean

returns

RoomVerdict

the verdict

Depends on
#

Imported by
#