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:
@@ -9,9 +9,11 @@ $groups = $groups ?? [];
|
||||
<p class="page-subtitle">Manage your Linux servers</p>
|
||||
</div>
|
||||
<div class="page-header-right">
|
||||
<?php if (is_admin()): ?>
|
||||
<a href="/servers/create" class="btn btn-primary">
|
||||
<i class="fas fa-plus"></i> Add Server
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -45,7 +47,9 @@ $groups = $groups ?? [];
|
||||
<div class="empty-state">
|
||||
<i class="fas fa-server"></i>
|
||||
<p>No servers found.</p>
|
||||
<?php if (is_admin()): ?>
|
||||
<a href="/servers/create" class="btn btn-primary">Add Your First Server</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="table-responsive">
|
||||
@@ -106,6 +110,7 @@ $groups = $groups ?? [];
|
||||
<a href="/terminal/<?= $server['id'] ?>" class="btn btn-xs" title="Terminal">
|
||||
<i class="fas fa-terminal"></i>
|
||||
</a>
|
||||
<?php if (is_admin()): ?>
|
||||
<a href="/servers/<?= $server['id'] ?>/edit" class="btn btn-xs" title="Edit">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
@@ -113,6 +118,7 @@ $groups = $groups ?? [];
|
||||
onclick="deleteServer(<?= $server['id'] ?>, '<?= htmlspecialchars(addslashes($server['name'])) ?>')">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user