-
Notifications
You must be signed in to change notification settings - Fork 715
fix: rbac for native user for license call (main) #9529
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
Signed-off-by: Yashodhan Joshi <[email protected]>
|
Failed to generate code suggestions for PR |
Greptile OverviewGreptile SummaryFixed RBAC issue where native users in non-default organizations received 401 errors when accessing the license API endpoint, causing infinite logout loops. Key Changes:
Rationale: Confidence Score: 3/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant Validator as validate_credentials
participant UserDB as users::get_user
participant OrgUsers as org_users::list_orgs_by_user
participant Response as TokenValidationResponse
Client->>Validator: Request to /license (from non-default org)
Validator->>UserDB: get_user(org_id, user_id)
UserDB-->>Validator: None (user not in this org)
alt path == "license" (NEW)
Validator->>OrgUsers: list_orgs_by_user(user_id)
OrgUsers-->>Validator: Vec<UserOrgExpandedRecord>
alt !orgs.is_empty()
Validator->>Response: Create minimal access response
Note over Response: is_valid=true<br/>user_role=User<br/>is_internal_user=true
Validator-->>Client: Allow access (200)
else orgs.is_empty()
Validator->>Response: Create invalid response
Note over Response: is_valid=false
Validator-->>Client: Unauthorized (401)
end
else path != "license" (OLD behavior)
Validator->>Response: Create invalid response
Note over Response: is_valid=false
Validator-->>Client: Unauthorized (401)
end
|
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.
1 file reviewed, 2 comments
Signed-off-by: Yashodhan Joshi <[email protected]>
#9529 for v0.30.0 --------- Signed-off-by: Yashodhan Joshi <[email protected]> Co-authored-by: Yashodhan Joshi <[email protected]>
Fixes an issue where a native user in non-default account would get 401 for license api call, whereas we want all users to have get access to license call.