Roles - what each role lets its agents open: an admin role opens * everything, any other a level of each module. Each shows its access at a * glance and its agents (opening Users filtered to them). A role can be * changed, copied as the start of another, archived - kept for the agents * archived with it, not offered for new ones - or, while nobody has it, * deleted. The work is in functions/roles.php; the handlers are * admin/post/roles.php. */ require_once "includes/inc_all_admin.php"; $show_archived = isset($_GET['archived']); $search = trim((string) ($_GET['q'] ?? '')); $all_roles = roleRows(); $roles = []; $archived_count = 0; foreach ($all_roles as $role_id => $row) { $archived_count += $row['role_archived_at'] ? 1 : 0; if ((bool) $row['role_archived_at'] !== $show_archived) { continue; } if ($search !== '' && mb_stripos($row['role_name'], $search) === false && mb_stripos((string) $row['role_description'], $search) === false) { continue; } $roles[$role_id] = $row; } $agents = roleAgents(array_keys($roles), 5); // This page with some of its query changed - null drops a key $page_url = function (array $change = []) use ($show_archived, $search) { $query = array_merge(['q' => $search !== '' ? $search : null, 'archived' => $show_archived ? 1 : null], $change); return 'roles.php' . (($query = http_build_query(array_filter($query, function ($v) { return $v !== null; }))) ? "?$query" : ''); }; $csrf = $_SESSION['csrf_token']; ?>

Roles

A role sets what its agents can open - an admin role everything, including Admin; any other a level of each part of ITFlow. Which clients an agent sees is set on the agent, in Users.

$row) { $name = escapeHtml($row['role_name']); $is_admin = intval($row['role_is_admin']) === 1; $is_mine = $role_id === intval($session_user_role); $edit_url = "modals/role/role_edit.php?id=$role_id"; $agent_count = intval($row['agents']); $archive_blocker = roleArchiveBlocker($row); $delete_blocker = roleDeleteBlocker($row); // The agents with it - a few faces and how many, opening Users filtered to them ob_start(); if ($agent_count) { ?> agent Nobody
archived
Role Access Agents Action
Yours
Archived
'roles', 'title' => $show_archived ? 'No archived roles' : 'No roles yet', 'text' => $show_archived ? 'An archived role stays with the agents archived with it, but isn\'t given to anyone new.' : 'A role sets what its agents can open.', 'icon' => 'fa-user-shield', 'filtered' => $search !== '', 'clear_url' => $page_url(['q' => null]), 'actions' => $show_archived ? [] : [['label' => 'New Role', 'modal' => 'modals/role/role_add.php', 'size' => 'lg']], ]) ?>