- Introduce a comprehensive permission system for subusers, including permission nodes and types with support for vehicles, bookings, orders, subusers, and self-serve modules. - Implement `subusers_user`, `subuser_user_grant`, and `subusers_permission_node` classes for managing subuser permissions and grants. - Extend `subuser_grants_o` with methods to retrieve permissions for subusers linked to customers. - Add traits and enumerations to streamline permission handling across modules. - Update subuser session handling to include token-based subuser lookups.
53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace modules\subusers\classes;
|
|
|
|
use modules\subusers\helpers\subusers_permission_node_key;
|
|
use modules\subusers\helpers\subusers_permission_type;
|
|
use modules\subusers\interfaces\subusers_permission_node_i;
|
|
use modules\subusers\traits\subusers_permission_node_t;
|
|
|
|
class subusers_permission_node implements subusers_permission_node_i
|
|
{
|
|
use subusers_permission_node_t;
|
|
|
|
/**
|
|
* The node key of the permission node, used for internal reference and storage
|
|
* @var subusers_permission_node_key $nodeKey
|
|
*/
|
|
protected subusers_permission_node_key $nodeKey;
|
|
/**
|
|
* The name of the permission node
|
|
* @var string $name
|
|
*/
|
|
public string $name;
|
|
/**
|
|
* The description of the permission node
|
|
* @var string $description
|
|
*/
|
|
public string $description;
|
|
/**
|
|
* The type of permission this node represents
|
|
* @var subusers_permission_type $type
|
|
*/
|
|
public subusers_permission_type $type;
|
|
/**
|
|
* The value of the permission node, true if the permission is granted, false if not
|
|
* @var bool|null $value
|
|
*/
|
|
public ?bool $value;
|
|
|
|
public function __construct(
|
|
subusers_permission_node_key $nodeKey,
|
|
string $name,
|
|
string $description,
|
|
subusers_permission_type $type,
|
|
?bool $value = null
|
|
) {
|
|
$this->nodeKey = $nodeKey;
|
|
$this->name = $name;
|
|
$this->description = $description;
|
|
$this->type = $type;
|
|
$this->value = $value;
|
|
}
|
|
} |