mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-26 01:10:30 -04:00
fix(auth): enforce dashboard authorization and improve team deletion
Add authorization gates to Project and Server creation buttons in the dashboard to prevent non-admin users from accessing resource creation. Improve team deletion to clear cache before deletion and automatically switch to the user's next available team. - Hide create buttons from non-admin users in dashboard - Clear cache before team deletion to prevent stale session resolution - Switch user session to next available team when current team is deleted - Handle refreshSession when user has no remaining teams - Add tests for dashboard authorization enforcement and team deletion flow
This commit is contained in:
@@ -186,6 +186,14 @@ function refreshSession(?Team $team = null): void
|
||||
$team = User::find(Auth::id())->teams->first();
|
||||
}
|
||||
}
|
||||
|
||||
if (! $team) {
|
||||
session()->forget('currentTeam');
|
||||
Cache::forget('team:'.Auth::id());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear old cache key format for backwards compatibility
|
||||
Cache::forget('team:'.Auth::id());
|
||||
// Use new cache key format that includes team ID
|
||||
|
||||
Reference in New Issue
Block a user