misuzu/public-legacy/manage/users/roles.php

31 lines
719 B
PHP

<?php
namespace Misuzu;
use Misuzu\Users\User;
if(!User::hasCurrent() || !perms_check_user(MSZ_PERMS_USER, User::getCurrent()->getId(), MSZ_PERM_USER_MANAGE_ROLES)) {
echo render_error(403);
return;
}
$roles = $msz->getRoles();
$pagination = new Pagination($roles->countRoles(), 10);
if(!$pagination->hasValidOffset()) {
echo render_error(404);
return;
}
$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,
]);