mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 14:17:18 +00:00
fix(user): complete User model fixes for non-web contexts
- Fix currentTeam() to return null instead of crashing when no session - Fix role() to use $this->currentTeam() instead of global helper - Add roleInTeam() method for explicit team context - Remove unused otherTeams() method - Fix InviteLink authorization bypass when role() returns null - Fix confirmEmailChange() null safety for currentTeam() - Fix ActivityMonitor to handle null currentTeam with fallback chain 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2cf915aed8
commit
2743229cc4
3 files changed
+34
-20
No files matched your search
@@ -48,7 +48,7 @@ class InviteLink extends Component
|
||||
|
||||
// Prevent privilege escalation: users cannot invite someone with higher privileges
|
||||
$userRole = auth()->user()->role();
|
||||
if ($userRole === 'member' && in_array($this->role, ['admin', 'owner'])) {
|
||||
if (is_null($userRole) || ($userRole === 'member' && in_array($this->role, ['admin', 'owner']))) {
|
||||
throw new \Exception('Members cannot invite admins or owners.');
|
||||
}
|
||||
if ($userRole === 'admin' && $this->role === 'owner') {
|
||||
|
||||
Reference in new issue
Block a user