KMP PHP API Reference

Permission extends BaseEntity
in package

Permission Entity - KMP RBAC Permission System

Atomic unit of authorization defining what actions can be performed. Supports scoping (Global, Branch Only, Branch and Children) and requirements (membership, background check, min age, warrant).

Table of Contents

Constants

SCOPE_BRANCH_AND_CHILDREN  = 'Branch and Children'
SCOPE_BRANCH_ONLY  = 'Branch Only'
SCOPE_GLOBAL  = 'Global'
SCOPING_RULES  = [self::SCOPE_GLOBAL => self::SCOPE_GLOBAL, self::SCOPE_BRANCH_ONLY => self::SCOPE_BRANCH_ONLY, self::SCOPE_BRANCH_AND_CHILDREN => self::SCOPE_BRANCH_AND_CHILDREN]

Properties

$branch_id  : int|null
$created  : DateTime|null
$id  : int
$is_super_user  : bool
$is_system  : bool
$modified  : DateTime|null
$name  : string
$require_active_background_check  : bool
$require_active_membership  : bool
$require_min_age  : int
$requires_warrant  : bool
$roles  : array<string|int, Role>
$scoping_rule  : string
$_accessible  : array<string, bool>
Fields that can be mass assigned using newEntity() or patchEntity().

Methods

getBranchId()  : int|null
Get the branch ID for authorization checks.
_setScopingRule()  : mixed
Set the scoping rule virtual field.

Constants

SCOPE_BRANCH_AND_CHILDREN

public mixed SCOPE_BRANCH_AND_CHILDREN = 'Branch and Children'

SCOPE_BRANCH_ONLY

public mixed SCOPE_BRANCH_ONLY = 'Branch Only'

SCOPE_GLOBAL

public mixed SCOPE_GLOBAL = 'Global'

SCOPING_RULES

public mixed SCOPING_RULES = [self::SCOPE_GLOBAL => self::SCOPE_GLOBAL, self::SCOPE_BRANCH_ONLY => self::SCOPE_BRANCH_ONLY, self::SCOPE_BRANCH_AND_CHILDREN => self::SCOPE_BRANCH_AND_CHILDREN]

Properties

$branch_id

public int|null $branch_id

Associated branch ID (when applicable)

$created

public DateTime|null $created

Creation timestamp

$is_super_user

public bool $is_super_user

Super user permission flag

$is_system

public bool $is_system

System permission flag

$modified

public DateTime|null $modified

Last modification timestamp

$require_active_background_check

public bool $require_active_background_check

Background check requirement

$require_active_membership

public bool $require_active_membership

Membership requirement

$require_min_age

public int $require_min_age

Minimum age requirement

$requires_warrant

public bool $requires_warrant

Warrant requirement

$roles

public array<string|int, Role> $roles

Roles with this permission

$scoping_rule

public string $scoping_rule

SCOPE_GLOBAL, SCOPE_BRANCH_ONLY, or SCOPE_BRANCH_AND_CHILDREN

$_accessible

Fields that can be mass assigned using newEntity() or patchEntity().

protected array<string, bool> $_accessible = ['name' => true, 'require_active_membership' => true, 'require_active_background_check' => true, 'require_min_age' => true, 'is_system' => true, 'is_super_user' => true, 'requires_warrant' => true, 'scoping_rule' => true, 'roles' => true]

Note that when '' is set to true, this allows all unspecified fields to be mass assigned. For security purposes, it is advised to set '' to false (or remove it), and explicitly make individual fields accessible as needed.

Methods

getBranchId()

Get the branch ID for authorization checks.

public getBranchId() : int|null

Child classes should override for complex branch relationships.

Return values
int|null

The branch ID, or null if no association

_setScopingRule()

Set the scoping rule virtual field.

protected _setScopingRule(mixed $value) : mixed
Parameters
$value : mixed

        
On this page

Search results