SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
complete project code, remain test code
guosjdb7766323eea
diff --git a/weed/iamapi/iamapi_management_handlers.go b/weed/iamapi/iamapi_management_handlers.goindex e8092020be..a7ca69f453 100644--- a/weed/iamapi/iamapi_management_handlers.go+++ b/weed/iamapi/iamapi_management_handlers.go@@ -4,10 +4,6 @@ import ("crypto/sha1""encoding/json""fmt"- "github.com/chrislusf/seaweedfs/weed/glog"- "github.com/chrislusf/seaweedfs/weed/pb/iam_pb"- "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"- "github.com/chrislusf/seaweedfs/weed/s3api/s3err""math/rand""net/http""net/url"@@ -16,6 +12,11 @@ import ("sync""time"+ "github.com/chrislusf/seaweedfs/weed/glog"+ "github.com/chrislusf/seaweedfs/weed/pb/iam_pb"+ "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"+ "github.com/chrislusf/seaweedfs/weed/s3api/s3err"+"github.com/aws/aws-sdk-go/service/iam")@@ -155,6 +156,22 @@ func (iama *IamApiServer) GetUser(s3cfg *iam_pb.S3ApiConfiguration, userName strreturn resp, fmt.Errorf(iam.ErrCodeNoSuchEntityException)}+func (iama *IamApiServer) UpdateUser(s3cfg *iam_pb.S3ApiConfiguration, values url.Values) (resp UpdateUserResponse, err error) {+ userName := values.Get("UserName")+ newUserName := values.Get("NewUserName")+ if newUserName != "" {+ for _, ident := range s3cfg.Identities {+ if userName == ident.Name {+ ident.Name = newUserName+ return resp, nil+ }+ }+ } else {+ return resp, nil+ }+ return resp, fmt.Errorf(iam.ErrCodeNoSuchEntityException)+}+func GetPolicyDocument(policy *string) (policyDocument PolicyDocument, err error) {if err = json.Unmarshal([]byte(*policy), &policyDocument); err != nil {return PolicyDocument{}, err@@ -396,6 +413,13 @@ func (iama *IamApiServer) DoActions(w http.ResponseWriter, r *http.Request) {return}changed = false+ case "UpdateUser":+ response, err = iama.UpdateUser(s3cfg, values)+ if err != nil {+ glog.Errorf("UpdateUser: %+v", err)+ s3err.WriteErrorResponse(w, r, s3err.ErrInvalidRequest)+ return+ }case "DeleteUser":userName := values.Get("UserName")response, err = iama.DeleteUser(s3cfg, userName)diff --git a/weed/iamapi/iamapi_response.go b/weed/iamapi/iamapi_response.goindex 77328b6086..df9443f0da 100644--- a/weed/iamapi/iamapi_response.go+++ b/weed/iamapi/iamapi_response.go@@ -66,6 +66,11 @@ type GetUserResponse struct {} `xml:"GetUserResult"`}+type UpdateUserResponse struct {+ CommonResponse+ XMLName xml.Name `xml:"https://iam.amazonaws.com/doc/2010-05-08/ UpdateUserResponse"`+}+type CreateAccessKeyResponse struct {CommonResponseXMLName xml.Name `xml:"https://iam.amazonaws.com/doc/2010-05-08/ CreateAccessKeyResponse"`