27 lines
757 B
PHP
27 lines
757 B
PHP
<?php
|
|
namespace Misuzu;
|
|
|
|
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
|
|
die('Script must be called through the Misuzu route dispatcher.');
|
|
|
|
if(!$msz->authInfo->getPerms('user')->check(Perm::U_ROLES_MANAGE))
|
|
Template::throwError(403);
|
|
|
|
$roles = $msz->usersCtx->roles;
|
|
$pagination = Pagination::fromInput($roles->countRoles(), 10);
|
|
if(!$pagination->validOffset)
|
|
Template::throwError(404);
|
|
|
|
$rolesAll = [];
|
|
$roleInfos = $roles->getRoles(pagination: $pagination);
|
|
|
|
foreach($roleInfos as $roleInfo)
|
|
$rolesAll[] = [
|
|
'info' => $roleInfo,
|
|
'members' => $roles->countRoleUsers($roleInfo),
|
|
];
|
|
|
|
Template::render('manage.users.roles', [
|
|
'manage_roles' => $rolesAll,
|
|
'manage_roles_pagination' => $pagination,
|
|
]);
|