Files
ops-Gazelle/sections/user/permissions.php
T

25 lines
536 B
PHP

<?php
if (!$Viewer->permitted('admin_manage_permissions')) {
error(403);
}
$userMan = new Gazelle\Manager\User;
$user = $userMan->findById((int)($_REQUEST['userid']));
if (is_null($user)) {
error(404);
}
$userId = $user->id();
if (isset($_POST['action'])) {
authorize();
$user->modifyPermissionList(
array_filter($_POST, function ($p) {return strpos($p, 'perm_') === 0;}, ARRAY_FILTER_USE_KEY)
);
}
echo $Twig->render('user/privilege-list.twig', [
'auth' => $Viewer->auth(),
'user' => $user,
]);