API Models DifferenceV1Interface - evansims/openfga-php GitHub Wiki
Defines a difference operation between two usersets in authorization models. DifferenceV1 represents a set operation that computes "base minus subtract," effectively granting access to users in the base userset while explicitly denying access to users in the subtract userset. This enables complex authorization patterns like "all employees except contractors" or "organization members except suspended users." Use this interface when implementing authorization logic that requires explicit exclusion of certain users from a broader permission set.
Table of Contents
OpenFGA\Models
ModelInterface
JsonSerializable
- DifferenceV1 (implementation)
public function getBase(): UsersetInterface
Get the base userset from which users will be subtracted. This represents the initial set of users or relationships from which the subtract userset will be removed to compute the final difference.
UsersetInterface
— The base userset for the difference operation
public function getSubtract(): UsersetInterface
Get the userset of users to subtract from the base userset. This represents the set of users or relationships that should be removed from the base userset to compute the final result of the difference operation.
UsersetInterface
— The userset to subtract from the base
public function jsonSerialize(): array
array