Add server ownership, team access, role-based UI, and default admin role
- New migration 002_server_access.sql: created_by column + server_user table - Server model: ownership, permission checks, team management methods - Routes: /team routes, RoleMiddleware on /servers/create and /admin - ServerController: permission checks via server_user, team CRUD methods - TerminalController: server access checks - DashboardController: filter servers by accessible ones - ApiController: server access checks - Views: team.php, team_server.php, sidebar Team link, hide actions by role - Default user role changed from operator to admin on registration - Admin user form defaults to admin role
This commit is contained in:
@@ -62,7 +62,7 @@ class AdminController
|
||||
'username' => $_POST['username'],
|
||||
'email' => $_POST['email'],
|
||||
'password' => $_POST['password'],
|
||||
'role' => $_POST['role'],
|
||||
'role' => $_POST['role'] ?? 'admin',
|
||||
'is_active' => 1,
|
||||
]);
|
||||
|
||||
@@ -159,6 +159,11 @@ class AdminController
|
||||
|
||||
public function securitySettings(): void
|
||||
{
|
||||
if (Session::get('user_role') !== 'super_admin') {
|
||||
Session::setFlash('error', 'You do not have permission to access this page.');
|
||||
$this->view->redirect('/dashboard');
|
||||
}
|
||||
|
||||
$this->view->display('admin.security', [
|
||||
'title' => 'Security Settings - ServerManager',
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user