Oihana PHP System

HasProtectedResource

Provides common authorization and protection-related properties for a resource.

This trait can be used by schema objects, entities, or models representing protected resources such as roles, permissions, groups, or system-managed objects in an authentication or authorization context.

The properties exposed by this trait are typically used to control:

  • Visual representation ($color)
  • Write protection through APIs ($protected)
  • System-level immutability ($system)
Tags
author

Marc Alcaraz

since
1.0.2

Table of Contents

Properties

$color  : string|null
The display color associated with this resource.
$protected  : bool|null
Indicates whether this resource is protected.
$system  : bool|null
Indicates whether this resource is a system-defined resource.

Properties

$color

The display color associated with this resource.

public string|null $color

This value is generally used for UI rendering purposes such as labels, badges, tags, or administration panels.

Example:

$resource->color = '#ff6600';

$protected

Indicates whether this resource is protected.

public bool|null $protected

A protected resource cannot normally be modified or assigned through public REST API operations or non-privileged actions.

Example:

$resource->protected = true;

$system

Indicates whether this resource is a system-defined resource.

public bool|null $system

System resources are generally immutable and cannot be deleted through REST APIs or standard administrative operations.

Example:

$resource->system = true;
On this page

Search results