FakeI1Guard class final
The I1 guard of the fake's rights changes (10 5.4, 11; BR-01, BR-07, BR-08).
run applies a change, checks I1 for every active personal agent of the world afterwards
and restores everything on a violation; the request's resolve_i1 switches the listed
agents to organization first. dryRun does the same for a preview and always restores.
Example:
final guard = FakeI1Guard(world, audit);
return guard.run(r, action: 'owner.add', resourceKind: 'user', apply: () {
person.isOwner = true;
return (response: FakeResponse(201, owner), resourceId: person.id, details: {});
});
Constructors
- FakeI1Guard(FakeWorld world, FakeAuditLog audit)
-
Creates the guard over
world; audit rows go toaudit.
Properties
- audit → FakeAuditLog
-
The audit log of the rows of every change.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- world → FakeWorld
-
The world.
final
Methods
-
conflictsJson(
Map< String, List< conflicts) → List<String> >JsonMap> -
The
conflictsof a409 i1_violation(InvariantViolation, 10 5.4). -
dryRun(
JsonMap body, void apply()) → Map< String, List< String> > -
The I1 conflicts the request
bodywould cause: switches itsresolve_i1agents, runsapplyand checks, then restores everything (a preview writes nothing, 07 9.3). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
previewSentences(
Map< String, List< conflicts) → List<String> >String> - One sentence per conflict for the preview text (10 11 point 2, English like the fake's other preview texts).
-
previewViolations(
Map< String, List< conflicts) → List<String> >JsonMap> -
The
invariant_violationsof a grant preview (10 11 point 1): the conflicts withorganization_ready(the agent reportsorganizationamongbilling_modes_supported) and the i1Hint. -
resolveAgents(
JsonMap body) → List< FakeAgent> -
The agents of the
resolve_i1ofbody, in ascending ID (10 11: the server authorizes them in ascending id); none withoutresolve_i1. -
run(
FakeRequest r, {required String action, required String resourceKind, required FakeChange apply()}) → FakeResponse -
Runs
applyas one rights change ofrwith the audit rowactiononresourceKind. -
setPolicy(
FakeAgent a, String mode, String? holder) → void -
Sets the policy of
atomodewithholder, raises its version and the permission version and stampsbilling_mode_changed_at. -
switchToOrganization(
FakeAgent a, {required String actor, required String reason, required String correlationId}) → void -
Switches
atoorganizationforresolve_i1with one audit rowagent.billing_mode.set(10 11: an agent already there keeps its row and gets a row withno_change). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
holderOf(
FakeAgent a) → String? -
The holder that counts for
a: itscredential_holder_idonpersonal, else null. -
policyDetails(
String fromMode, String? fromHolder, String toMode, String? toHolder, String reason) → JsonMap -
The audit details of a policy switch of one agent, as the server writes them
(
policyAttrsof services/server/internal/agents/app/policy.go, 10 14).