API Models RelationReferenceInterface - evansims/openfga-php GitHub Wiki
Defines the contract for relation references with optional conditions. A relation reference specifies a particular relation within a type definition, optionally with an associated condition that must be satisfied. This allows for conditional access patterns where relationships are only valid when certain runtime conditions are met. Use this when you need to reference specific relations in your authorization model, especially when implementing attribute-based access control (ABAC) patterns.
Table of Contents
OpenFGA\Models
ModelInterface
JsonSerializable
- RelationReference (implementation)
public function getCondition(): string|null
Get the optional condition name that must be satisfied. When specified, this condition must evaluate to true for the relation reference to be valid. This enables conditional access based on runtime context and attributes.
string
| null
— The condition name, or null if no condition is required
public function getRelation(): string|null
Get the optional specific relation on the referenced type. When specified, this limits the reference to a specific relation on the target type rather than the entire type. This allows for more precise relationship definitions.
string
| null
— The relation name, or null to reference the entire type
public function getType(): string
Get the type being referenced. This is the object type that this reference points to. It defines which type of objects can be used in relationships through this reference.
string
— The type name being referenced
public function getWildcard(): object|null
Get the optional wildcard marker for type-level permissions. When present, this indicates that the reference applies to all instances of the specified type, rather than specific instances. This is useful for granting permissions at the type level.
object
| null
— The wildcard marker, or null for instance-specific references
public function jsonSerialize(): array
array