-
-
Notifications
You must be signed in to change notification settings - Fork 254
Fix user permissions service #1819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughUpdated GetUserPermissionsService to use explicit owner/admin flags, centralize admin websocket permissions, change owner-only behavior to exclude admins, and simplify subuser permission retrieval with null coalescing. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Service as GetUserPermissionsService
note right of Service #f3f4f6: Inputs: user, server, subuser (optional)
Client->>Service: requestPermissions(user, server, subuser)
Service->>Service: determine $isOwner, $isAdmin
alt owner AND NOT admin
Service-->>Client: return ['*']
else admin
Service->>Service: $adminPermissions = [websocket-related]
alt canUpdate OR isOwner
Service-->>Client: return ['*'] + $adminPermissions
else
Service-->>Client: return [Permission::ACTION_WEBSOCKET_CONNECT] + $adminPermissions
end
else subuser present
Service->>Service: $subuser = ... (rename)
Service-->>Client: return $subuser->permissions ?? []
else
Service-->>Client: return []
end
Pre-merge checks✅ Passed checks (5 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)app/Services/Servers/GetUserPermissionsService.php (2)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/Services/Servers/GetUserPermissionsService.php(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/Services/Servers/GetUserPermissionsService.php (2)
app/Models/Permission.php (2)
Permission(11-221)permissions(194-213)app/Models/User.php (3)
isAdmin(384-387)can(357-370)subusers(309-312)
🔇 Additional comments (2)
app/Services/Servers/GetUserPermissionsService.php (2)
21-26: LGTM! Clean separation of owner and admin logic.The explicit flags improve readability, and the logic correctly ensures that users who are both owner and admin are routed through the admin block to receive admin-specific permissions.
28-36: Admin permissions refactor correctly addresses empty console during installation.The refactoring centralizes admin websocket permissions (
admin.websocket.errors,admin.websocket.install,admin.websocket.transfer) into a dedicated array. Theadmin.websocket.installpermission is essential—Wings validates this permission before sending installation event logs to the connected websocket, enabling console output during server installation and reinstallation. This fix resolves issue #1796.
notAreYouScared
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appears to work as intended.
Closes #1796
Supersedes #1814