authInfo->getPerms('user')->check(Perm::U_USERS_MANAGE)) Template::throwError(403); $pagination = Pagination::fromInput($msz->usersCtx->users->countUsers(), 30); if(!$pagination->validOffset) Template::throwError(404); $userList = []; $userInfos = $msz->usersCtx->users->getUsers(pagination: $pagination, orderBy: 'id'); $roleInfos = []; foreach($userInfos as $userInfo) { $displayRoleId = $userInfo->displayRoleId ?? Roles::DEFAULT_ROLE; if(array_key_exists($displayRoleId, $roleInfos)) $roleInfo = $roleInfos[$displayRoleId]; else $roleInfos[$displayRoleId] = $roleInfo = $msz->usersCtx->roles->getRole($displayRoleId); $colour = $userInfo->hasColour ? $userInfo->colour : $roleInfo->colour; $userList[] = [ 'info' => $userInfo, 'role' => $roleInfo, 'colour' => $colour, ]; } Template::render('manage.users.users', [ 'manage_users' => $userList, 'manage_users_pagination' => $pagination, ]);