API Requests CreateAuthorizationModelRequest - evansims/openfga-php GitHub Wiki
Request for creating a new authorization model in OpenFGA. Authorization models define the permission structure for your application, including object types, relationships, and how permissions are computed. Models are immutable once created and identified by a unique ID.
Table of Contents
OpenFGA\Requests
- CreateAuthorizationModelResponse (response)
- CreateAuthorizationModelRequestInterface (interface)
public function getConditions(): ?OpenFGA\Models\Collections\ConditionsInterfaceGet the conditional rules for the authorization model. Returns a collection of conditions that define dynamic authorization logic based on runtime context. Conditions allow for sophisticated access control scenarios such as time-based access, location restrictions, resource attributes, or custom business logic. Conditions are referenced by name within type definitions and evaluated at permission check time using contextual data provided in authorization requests. They enable attribute-based access control (ABAC) patterns within the relationship-based authorization framework.
ConditionsInterface | null — Collection of conditional rules for dynamic authorization, or null if no conditions are defined
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContextBuild a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
| Name | Type | Description |
|---|---|---|
$streamFactory |
StreamFactoryInterface |
PSR-7 stream factory for creating request body streams from serialized data |
RequestContext — The prepared request context containing HTTP method, URL, headers, and body ready for execution
public function getSchemaVersion(): OpenFGA\Models\Enums\SchemaVersionGet the schema version for the authorization model. Specifies which version of the OpenFGA modeling language should be used to interpret the authorization model definition. Different schema versions support different features and syntax, allowing OpenFGA to evolve while maintaining backward compatibility. The schema version determines: - Available relationship operators and syntax - Supported conditional expression features - Type definition validation rules - API compatibility and behavior
SchemaVersion — The modeling language schema version for this authorization model
public function getStore(): stringGet the store ID where the authorization model will be created. Identifies the OpenFGA store that will contain the new authorization model. Each store can have multiple model versions, allowing you to evolve your authorization schema over time while maintaining access to previous versions for consistency and rollback scenarios.
string — The store ID where the authorization model will be created
public function getTypeDefinitions(): OpenFGA\Models\Collections\TypeDefinitionsInterfaceGet the type definitions for the authorization model. Returns a collection of type definitions that specify the object types and their allowed relationships within the authorization model. Type definitions form the core schema that defines what objects exist in your system and how they can be related to users and other objects. Each type definition includes: - Object type name (for example "document," "folder," "organization") - Allowed relationships (for example "owner," "editor," "viewer") - Relationship inheritance and computation rules - References to conditional logic for dynamic authorization
TypeDefinitionsInterface — Collection of object type definitions that define the authorization schema