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

ACLs: Modify superuser command and add migrate flow #8087

Merged
merged 7 commits into from
Aug 20, 2024

Conversation

N-o-Z
Copy link
Member

@N-o-Z N-o-Z commented Aug 20, 2024

Closes #8083

Change Description

Updated superuser command to handle different types of auth services + added migration flow

About this change:

We can modify this PR in 2 vectors

  1. We can separate the command itself for the migration flow if needed, I believe this will just create a redundant command that will be used a single time and by a limited number of users
  2. We can move the migration logic from the AddCredentials flow. But this will probably require us to create a new endpoint for this matter

@N-o-Z N-o-Z added the exclude-changelog PR description should not be included in next release changelog label Aug 20, 2024
@N-o-Z N-o-Z requested a review from guy-har August 20, 2024 00:32
@N-o-Z N-o-Z self-assigned this Aug 20, 2024
Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed

Copy link

E2E Test Results - Quickstart

10 passed

Copy link
Contributor

@guy-har guy-har left a comment

Choose a reason for hiding this comment

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

Amazing
Thanks

Comment on lines 31 to 32
}
RunCmdAndVerifyFailureContainsText(t, lakefsCmd+" superuser --user-name "+AdminUsername, false, "already exists", nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just add a comment that the AdminUserName is created on init

Comment on lines 50 to 64
require.NoError(t, err)
require.Equal(t, username, createRes)

// Check it is saved under the admin key
_, err = store.Get(ctx, []byte(auth.BasicPartitionKey), model.UserPath(auth.SuperAdminKey))
require.NoError(t, err)

// List users
listRes, _, err = s.ListUsers(ctx, nil)
require.NoError(t, err)
require.Equal(t, 1, len(listRes))
require.Equal(t, username, listRes[0].Username)

// Delete user
err = s.DeleteUser(ctx, username)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also add a getUser when user exists

Comment on lines +184 to +191
creds, err := s.listUserCredentials(ctx, username, model.PartitionKey, accessKeyID)
if err != nil {
return nil, err
}
if len(creds) < 1 {
return nil, fmt.Errorf("no credentials found for user (%s): %w", username, ErrNotFound)
}
return s.addCredentials(ctx, username, creds[0].AccessKeyID, creds[0].SecretAccessKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC - if the user has more than two credentials, it will return not found! please check this and add a test if that's the case

Copy link
Member Author

Choose a reason for hiding this comment

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

We are using listUserCredentials with the accessKeyID as a prefix, this will return a list of no more than 1 items. Either the key exists or it doesn't

Copy link
Contributor

Choose a reason for hiding this comment

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

I missed the prefix, thanks!

@N-o-Z N-o-Z merged commit d42763c into master Aug 20, 2024
38 checks passed
@N-o-Z N-o-Z deleted the task/acl-create-superadmin-8083 branch August 20, 2024 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude-changelog PR description should not be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ACLs: Create new lakeFS command to create superadmin user
2 participants