Skip to content
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

chore: saas authz changes for rbac #9657

Merged
merged 2 commits into from
Jul 24, 2024
Merged

chore: saas authz changes for rbac #9657

merged 2 commits into from
Jul 24, 2024

Conversation

trentwatt
Copy link
Contributor

@trentwatt trentwatt commented Jul 16, 2024

Ticket

https://hpe-aiatscale.atlassian.net/browse/DET-10315

Description

Provisions RBAC user with role assignments to their personal group based on the defaultClusterRole in the token.

Also, since it's no longer feasible to update role assignments based on changes from saas, we are allowing for the updating of a user's active status via token.

Test Plan

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

@cla-bot cla-bot bot added the cla-signed label Jul 16, 2024
Copy link

netlify bot commented Jul 16, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit d8b88eb
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/669ed369d530600008149de1
😎 Deploy Preview https://deploy-preview-9657--determined-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 3.07692% with 126 lines in your changes missing coverage. Please review.

Project coverage is 53.53%. Comparing base (f721751) to head (d8b88eb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9657      +/-   ##
==========================================
- Coverage   53.56%   53.53%   -0.03%     
==========================================
  Files        1255     1256       +1     
  Lines      152701   152742      +41     
  Branches     3292     3293       +1     
==========================================
- Hits        81788    81778      -10     
- Misses      70763    70814      +51     
  Partials      150      150              
Flag Coverage Δ
backend 44.70% <3.07%> (-0.06%) ⬇️
harness 72.84% <ø> (ø)
web 52.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
master/internal/user/postgres_scim_users.go 85.35% <100.00%> (ø)
master/pkg/model/saas.go 0.00% <ø> (ø)
master/internal/api_user.go 70.21% <50.00%> (ø)
master/internal/core.go 6.47% <0.00%> (-0.01%) ⬇️
master/internal/plugin/scim/service.go 0.00% <0.00%> (ø)
master/internal/user/postgres_users.go 83.70% <0.00%> (ø)
master/internal/saas/saas.go 16.66% <16.66%> (ø)
...ster/internal/saas/saasprovisioner/provisioners.go 0.84% <0.84%> (ø)

... and 6 files with indirect coverage changes

@@ -34,7 +34,7 @@ func AddSCIMUser(ctx context.Context, suser *model.SCIMUser) (*model.SCIMUser, e
userID, err := AddUserTx(ctx, tx, &model.User{
Username: suser.Username,
DisplayName: suser.DisplayName,
Active: true,
Active: suser.Active,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

@@ -187,6 +187,7 @@ func (s *service) PostUser(c echo.Context) (interface{}, error) {
return nil, errors.WithStack(err)
}

u.Active = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is to preserve the existing behavior of this code path in light of the following change:
https://github.com/determined-ai/determined/pull/9657/files#r1687035860

@trentwatt trentwatt marked this pull request as ready for review July 22, 2024 19:18
@trentwatt trentwatt requested a review from a team as a code owner July 22, 2024 19:18
@trentwatt trentwatt requested a review from maxrussell July 22, 2024 19:18
Comment on lines +560 to +562
if a.m.config.InternalConfig.ExternalSessions.Enabled() {
return nil, errExternalSessions
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this was missed last time. we have this check on PatchUser but not on PatchUsers

Comment on lines -624 to -626
if a.m.config.InternalConfig.ExternalSessions.Enabled() {
return nil, errExternalSessions
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check is erroneous, user settings are not a user management feature, they are a part of how the web stores user preferences

@trentwatt trentwatt merged commit 0703e8a into main Jul 24, 2024
80 of 94 checks passed
@trentwatt trentwatt deleted the trent/saas-authz branch July 24, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants