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
OpenFGA\Models
UserObjectInterface
Stringable
JsonSerializable
ModelInterface
- UserObjectInterface (interface)
Name | Value | Description |
---|---|---|
OPENAPI_MODEL |
UserObject |
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.
string
— The object identifier
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.
string
— The object type
public function jsonSerialize(): array
Serialize the user object to its JSON representation.
array
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.
SchemaInterface
— The schema definition containing validation rules and property specifications for this model