diff options
| author | Riccardo Bertossa <33728857+rikigigi@users.noreply.github.com> | 2024-05-17 13:54:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-17 04:54:09 -0700 |
| commit | f6e8a9bf9ce3072cfd1d27157cc2a83f91d669df (patch) | |
| tree | d23141dd63cbb611247f78f8db53d3ba695d9b4e /weed/s3api/auth_credentials_test.go | |
| parent | 54f3913bedf3145a899f2ef872735dd54e468fcc (diff) | |
| download | seaweedfs-f6e8a9bf9ce3072cfd1d27157cc2a83f91d669df.tar.xz seaweedfs-f6e8a9bf9ce3072cfd1d27157cc2a83f91d669df.zip | |
added s3 iam DeleteBucket permission management (#5599)
Diffstat (limited to 'weed/s3api/auth_credentials_test.go')
| -rw-r--r-- | weed/s3api/auth_credentials_test.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/weed/s3api/auth_credentials_test.go b/weed/s3api/auth_credentials_test.go index f9f87fc54..1d9f1a95f 100644 --- a/weed/s3api/auth_credentials_test.go +++ b/weed/s3api/auth_credentials_test.go @@ -1,11 +1,12 @@ package s3api import ( - . "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" - "github.com/stretchr/testify/assert" "reflect" "testing" + . "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" + "github.com/stretchr/testify/assert" + "github.com/seaweedfs/seaweedfs/weed/pb/iam_pb" jsonpb "google.golang.org/protobuf/encoding/protojson" ) @@ -79,6 +80,7 @@ func TestCanDo(t *testing.T) { } // object specific assert.Equal(t, true, ident1.canDo(ACTION_WRITE, "bucket1", "/a/b/c/d.txt")) + assert.Equal(t, false, ident1.canDo(ACTION_DELETE_BUCKET, "bucket1", "")) assert.Equal(t, false, ident1.canDo(ACTION_WRITE, "bucket1", "/a/b/other/some"), "action without *") // bucket specific @@ -141,6 +143,15 @@ func TestCanDo(t *testing.T) { }, } assert.Equal(t, true, ident6.canDo(ACTION_READ, "anything_bucket", "/a/b/c/d.txt")) + + //test deleteBucket operation + ident7 := &Identity{ + Name: "anything", + Actions: []Action{ + "DeleteBucket:bucket1", + }, + } + assert.Equal(t, true, ident7.canDo(ACTION_DELETE_BUCKET, "bucket1", "")) } type LoadS3ApiConfigurationTestCase struct { |
