-
Notifications
You must be signed in to change notification settings - Fork 352
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
Conversation
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.
Amazing
Thanks
esti/lakefs_test.go
Outdated
} | ||
RunCmdAndVerifyFailureContainsText(t, lakefsCmd+" superuser --user-name "+AdminUsername, false, "already exists", nil) |
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.
Maybe just add a comment that the AdminUserName
is created on init
pkg/auth/basic_service_test.go
Outdated
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) |
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.
Maybe also add a getUser when user exists
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) |
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.
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
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.
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
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.
I missed the prefix, thanks!
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