API Models UserObject - evansims/openfga-php GitHub Wiki

Represents a specific user object with type and identifier. A UserObject provides a structured way to represent users in your authorization system with both a type (like "user," "service," "bot") and a unique identifier. This allows for clear categorization of different kinds of entities that can have permissions in your system. Use this when you need to represent users in a structured format rather than simple string identifiers.

Table of Contents


Namespace

OpenFGA\Models


Source

View source code


Implements


Related Classes


Constants

Name Value Description
OPENAPI_MODEL UserObject


Methods

getId

public function getId(): string

Get the unique identifier of the user object. The ID is unique within the context of the object type and represents the specific instance of the typed object.

View source


Returns

string — The object identifier


getType

public function getType(): string

Get the type of the user object. The type defines the category or class of the object (for example 'user', 'group', 'organization') and must be defined in the authorization model.

View source


Returns

string — The object type


jsonSerialize

public function jsonSerialize(): array

Serialize the user object to its JSON representation.

View source


Returns

array


schema

Implements Models\UserObjectInterface

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** ⚠️