Skip to content

Commit 8c45d07

Browse files
support wildcard on admin actions
1 parent 70e9b7a commit 8c45d07

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

policy/admin-action.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package policy
1919

2020
import (
2121
"github.com/minio/pkg/v3/policy/condition"
22+
"github.com/minio/pkg/v3/wildcard"
2223
)
2324

2425
// AdminAction - admin policy action.
@@ -362,10 +363,19 @@ var SupportedAdminActions = map[AdminAction]struct{}{
362363
AllAdminActions: {},
363364
}
364365

366+
// Match - matches action name with action pattern.
367+
func (action AdminAction) Match(a AdminAction) bool {
368+
return wildcard.Match(string(action), string(a))
369+
}
370+
365371
// IsValid - checks if action is valid or not.
366372
func (action AdminAction) IsValid() bool {
367-
_, ok := SupportedAdminActions[action]
368-
return ok
373+
for supAction := range SupportedAdminActions {
374+
if action.Match(supAction) {
375+
return true
376+
}
377+
}
378+
return false
369379
}
370380

371381
func createAdminActionConditionKeyMap() map[Action]condition.KeySet {

0 commit comments

Comments
 (0)