feat: Closes #441, Added access control integration tests, fixed some bugs in bucket policy and acl access checking flow

This commit is contained in:
jonaustin09
2024-03-28 14:52:56 -04:00
parent 0011ccd80e
commit e6203c5765
8 changed files with 376 additions and 49 deletions
+12
View File
@@ -537,6 +537,10 @@ type user struct {
func createUsers(s *S3Conf, users []user) error {
for _, usr := range users {
err := deleteUser(s, usr.access)
if err != nil {
return err
}
out, err := execCommand("admin", "-a", s.awsID, "-s", s.awsSecret, "-er", s.endpoint, "create-user", "-a", usr.access, "-s", usr.secret, "-r", usr.role)
if err != nil {
return err
@@ -633,3 +637,11 @@ func getMalformedPolicyError(msg string) s3err.APIError {
HTTPStatusCode: http.StatusBadRequest,
}
}
func getUserS3Client(usr user, cfg *S3Conf) *s3.Client {
config := *cfg
config.awsID = usr.access
config.awsSecret = usr.secret
return s3.NewFromConfig(config.Config())
}