aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/auth_credentials.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-07-13 16:21:36 -0700
committerGitHub <noreply@github.com>2025-07-13 16:21:36 -0700
commit7cb1ca13082568bfdcdab974d8cefddf650443c5 (patch)
tree573b5e15d080d37b9312cade4151da9e3fb7ddee /weed/s3api/auth_credentials.go
parent1549ee2e154ab040e211ac7b3bc361272069abef (diff)
downloadseaweedfs-7cb1ca13082568bfdcdab974d8cefddf650443c5.tar.xz
seaweedfs-7cb1ca13082568bfdcdab974d8cefddf650443c5.zip
Add policy engine (#6970)
Diffstat (limited to 'weed/s3api/auth_credentials.go')
-rw-r--r--weed/s3api/auth_credentials.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go
index e4e5fda83..7c731539f 100644
--- a/weed/s3api/auth_credentials.go
+++ b/weed/s3api/auth_credentials.go
@@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"os"
+ "slices"
"strings"
"sync"
@@ -345,11 +346,6 @@ func (iam *IdentityAccessManagement) Auth(f http.HandlerFunc, action Action) htt
if errCode == s3err.ErrNone {
if identity != nil && identity.Name != "" {
r.Header.Set(s3_constants.AmzIdentityId, identity.Name)
- if identity.isAdmin() {
- r.Header.Set(s3_constants.AmzIsAdmin, "true")
- } else if _, ok := r.Header[s3_constants.AmzIsAdmin]; ok {
- r.Header.Del(s3_constants.AmzIsAdmin)
- }
}
f(w, r)
return
@@ -526,12 +522,7 @@ func (identity *Identity) canDo(action Action, bucket string, objectKey string)
}
func (identity *Identity) isAdmin() bool {
- for _, a := range identity.Actions {
- if a == "Admin" {
- return true
- }
- }
- return false
+ return slices.Contains(identity.Actions, s3_constants.ACTION_ADMIN)
}
// GetCredentialManager returns the credential manager instance