API Models Userset - evansims/openfga-php GitHub Wiki
Represents a userset specification for computing groups of users. A Userset defines how to compute a collection of users through various means: computed relationships, tuple-to-userset operations, unions, intersections, or differences. This is a fundamental building block for complex authorization patterns where user groups are derived dynamically. Use this when defining how groups of users should be computed in your authorization model rules.
Table of Contents
OpenFGA\Models
UsersetInterface
JsonSerializable
ModelInterface
- UsersetInterface (interface)
Name | Value | Description |
---|---|---|
OPENAPI_MODEL |
Userset |
public function getComputedUserset(): ?OpenFGA\Models\ObjectRelationInterface
Get the computed userset specification for this userset. A computed userset defines relationships that are derived from other relationships, allowing for indirect authorization patterns. When present, this specifies an object-relation pair that should be computed to determine the actual users.
ObjectRelationInterface
| null
— The computed userset specification, or null if not used
public function getDifference(): ?OpenFGA\Models\DifferenceV1Interface
Get the difference operation specification for this userset. A difference operation represents a set subtraction where users are granted access based on one userset but explicitly excluded if they're in another. This enables sophisticated access control patterns like "all managers except those on leave."
DifferenceV1Interface
| null
— The difference operation specification, or null if not used
public function getDirect(): ?object
Get the direct userset value for this userset. A direct userset represents an immediate, explicit relationship without complex computation. This is typically used for simple membership patterns where users are directly assigned to a role or permission.
object
| null
— The direct userset value, or null if not used
public function getIntersection(): ?OpenFGA\Models\Collections\UsersetsInterface
Get the intersection operation specification for this userset. An intersection operation represents users who must satisfy ALL of the specified usersets. This creates a logical AND operation where users are granted access only if they're in every userset within the intersection.
UsersetsInterface
| null
— The collection of usersets to intersect, or null if not used
public function getTupleToUserset(): ?OpenFGA\Models\TupleToUsersetV1Interface
Get the tuple-to-userset operation specification for this userset. A tuple-to-userset operation computes users by examining existing relationships and following them to other usersets. This enables complex authorization patterns where permissions are inherited through relationship chains.
TupleToUsersetV1Interface
| null
— The tuple-to-userset operation specification, or null if not used
public function getUnion(): ?OpenFGA\Models\Collections\UsersetsInterface
Get the union operation specification for this userset. A union operation represents users who satisfy ANY of the specified usersets. This creates a logical OR operation where users are granted access if they're in at least one userset within the union.
UsersetsInterface
| null
— The collection of usersets to unite, or null if not used
public function jsonSerialize(): array
array
Implements Models\UsersetInterface
public function schema(): SchemaInterface
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
SchemaInterface
— The schema definition containing validation rules and property specifications for this model