Oihana PHP System

CasbinPolicy uses ConstantsTrait

Defines the standard keys used in Casbin policy rules.

Casbin policies are typically represented as arrays or objects with the following structure:

[
    'sub' => 'subject',  // the user or role performing the action
    'dom' => 'domain',   // the domain, tenant, or context of the resource
    'obj' => 'object',   // the resource being accessed
    'act' => 'action',   // the operation performed on the resource
    'eft' => 'effect',   // 'allow' or 'deny'
]

These constants can be used to safely reference the keys in your code, avoiding hardcoded strings and improving maintainability.

Tags
author

Marc Alcaraz (ekameleon)

since
1.0.2

Table of Contents

Constants

ACTION  = 'act'
The 'act' policy key.
DOMAIN  = 'dom'
The 'dom' policy key.
EFFECT  = 'eft'
The 'eft' policy key.
OBJECT  = 'obj'
The 'obj' policy key.
SUBJECT  = 'sub'
The 'sub' policy key.

Constants

ACTION

The 'act' policy key.

public mixed ACTION = 'act'

Refers to the action being performed (e.g., GET, POST, DELETE).

DOMAIN

The 'dom' policy key.

public mixed DOMAIN = 'dom'

Refers to the domain, tenant, or contextual boundary of the resource.

EFFECT

The 'eft' policy key.

public mixed EFFECT = 'eft'

Refers to the effect of the policy, either 'allow' or 'deny'.

OBJECT

The 'obj' policy key.

public mixed OBJECT = 'obj'

Refers to the resource being accessed (e.g., /organizations, /projects/:id).

SUBJECT

The 'sub' policy key.

public mixed SUBJECT = 'sub'

Refers to the subject of the policy, typically a user or a role.


        
On this page

Search results