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


Namespace

OpenFGA\Models


Source

View source code


Implements


Related Classes


Constants

Name Value Description
OPENAPI_MODEL Userset


Methods

getComputedUserset

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.

View source


Returns

ObjectRelationInterface | null — The computed userset specification, or null if not used


getDifference

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."

View source


Returns

DifferenceV1Interface | null — The difference operation specification, or null if not used


getDirect

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.

View source


Returns

object | null — The direct userset value, or null if not used


getIntersection

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.

View source


Returns

UsersetsInterface | null — The collection of usersets to intersect, or null if not used


getTupleToUserset

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.

View source


Returns

TupleToUsersetV1Interface | null — The tuple-to-userset operation specification, or null if not used


getUnion

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.

View source


Returns

UsersetsInterface | null — The collection of usersets to unite, or null if not used


jsonSerialize

public function jsonSerialize(): array

View source


Returns

array


schema

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.

View source


Returns

SchemaInterface — The schema definition containing validation rules and property specifications for this model

⚠️ **GitHub.com Fallback** ⚠️