CasbinPolicySyncEdgeTrait
Casbin policy synchronization edge dispatcher.
Subscribes to a generic edge model's afterInsert / afterDelete
signals and routes the events to the right per-domain handler based
on the EdgeSyncType value passed at registration time. Pure
router : every actual write to the Casbin Enforcer lives in one of
the per-domain traits (CasbinPolicySyncRoleTrait,
CasbinPolicySyncUserTrait,
CasbinPolicySyncServiceTrait,
CasbinPolicySyncPolicyTrait).
The trait expects the consumer class to expose the protected
?Enforcer $enforcer property (declared on
CasbinPolicySync via constructor promotion)
plus every per-domain add* / remove* handler reachable through
trait composition on the same class.
Tags
Table of Contents
Methods
- register() : void
- Registers this sync on an edge model's insert/delete signals.
- onEdgeDelete() : void
- Called when an edge is deleted.
- onEdgeInsert() : void
- Called when a new edge is inserted.
Methods
register()
Registers this sync on an edge model's insert/delete signals.
public
register(Edges $edges, string $type) : void
Parameters
- $edges : Edges
-
The edge model to listen to.
- $type : string
-
The edge type — one of EdgeSyncType's constants.
onEdgeDelete()
Called when an edge is deleted.
protected
onEdgeDelete(Payload $payload, string $type) : void
Parameters
- $payload : Payload
- $type : string
Tags
onEdgeInsert()
Called when a new edge is inserted.
protected
onEdgeInsert(Payload $payload, string $type) : void
Parameters
- $payload : Payload
- $type : string