Browse Source

list owned buckets

pull/7519/head
chrislu 2 weeks ago
parent
commit
b02f865183
  1. 15
      weed/s3api/s3api_bucket_handlers.go

15
weed/s3api/s3api_bucket_handlers.go

@ -64,6 +64,21 @@ func (s3a *S3ApiServer) ListBucketsHandler(w http.ResponseWriter, r *http.Reques
var listBuckets ListAllMyBucketsList var listBuckets ListAllMyBucketsList
for _, entry := range entries { for _, entry := range entries {
if entry.IsDirectory { if entry.IsDirectory {
// Check ownership: only show buckets owned by this user (unless admin)
if identity != nil && identityId != "" {
var bucketOwnerId string
if entry.Extended != nil {
if id, ok := entry.Extended[s3_constants.AmzIdentityId]; ok {
bucketOwnerId = string(id)
}
}
// Skip buckets not owned by this user (unless they're an admin)
if bucketOwnerId != "" && bucketOwnerId != identityId && !identity.isAdmin() {
continue
}
}
// Check permissions for each bucket // Check permissions for each bucket
if identity != nil { if identity != nil {
// For JWT-authenticated users, use IAM authorization // For JWT-authenticated users, use IAM authorization

Loading…
Cancel
Save