Deploy Ladill Queue / deploy (push) Successful in 56s
Phases 1–6: tickets, counters, displays, appointments, workflows, rules, analytics, reports, feedback, admin, device API, and Gitea deploy workflow for queue.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
66 lines
2.4 KiB
PHP
66 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Qms;
|
|
|
|
use App\Models\Member;
|
|
|
|
class QmsPermissions
|
|
{
|
|
/** @var array<string, list<string>> */
|
|
protected array $roleAbilities = [
|
|
'super_admin' => ['*'],
|
|
'org_admin' => ['*'],
|
|
'branch_manager' => [
|
|
'dashboard.view', 'queues.view', 'queues.manage', 'tickets.view', 'tickets.manage',
|
|
'counters.view', 'counters.manage', 'console.use', 'displays.view', 'displays.manage',
|
|
'appointments.view', 'appointments.manage', 'workflows.view', 'workflows.manage',
|
|
'rules.view', 'rules.manage', 'reports.view', 'reports.export', 'feedback.view',
|
|
'admin.branches.view', 'admin.branches.manage', 'admin.departments.view', 'admin.departments.manage',
|
|
'admin.members.view', 'admin.members.manage', 'settings.view', 'settings.manage', 'audit.view', 'audit.export',
|
|
],
|
|
'receptionist' => [
|
|
'dashboard.view', 'queues.view', 'tickets.view', 'tickets.issue',
|
|
'appointments.view', 'appointments.manage',
|
|
],
|
|
'queue_operator' => [
|
|
'dashboard.view', 'queues.view', 'queues.manage', 'tickets.view', 'tickets.manage',
|
|
'console.use', 'displays.view',
|
|
],
|
|
'counter_staff' => [
|
|
'dashboard.view', 'queues.view', 'tickets.view', 'console.use',
|
|
],
|
|
'department_manager' => [
|
|
'dashboard.view', 'queues.view', 'queues.manage', 'tickets.view', 'tickets.manage',
|
|
'counters.view', 'console.use', 'reports.view',
|
|
],
|
|
'security' => [
|
|
'dashboard.view', 'tickets.view',
|
|
],
|
|
'supervisor' => [
|
|
'dashboard.view', 'queues.view', 'tickets.view', 'tickets.manage',
|
|
'counters.view', 'console.use', 'reports.view', 'reports.export',
|
|
'feedback.view', 'audit.view', 'audit.export',
|
|
],
|
|
];
|
|
|
|
public function can(?Member $member, string $ability): bool
|
|
{
|
|
if ($member === null) {
|
|
return false;
|
|
}
|
|
|
|
$abilities = $this->roleAbilities[$member->role] ?? [];
|
|
|
|
if (in_array('*', $abilities, true)) {
|
|
return true;
|
|
}
|
|
|
|
return in_array($ability, $abilities, true);
|
|
}
|
|
|
|
public function isAdmin(?Member $member): bool
|
|
{
|
|
return $member !== null && in_array($member->role, ['super_admin', 'org_admin'], true);
|
|
}
|
|
}
|