mirror of
https://github.com/minio/minio.git
synced 2025-11-28 05:04:14 -05:00
Add support for new policy conditions (#7024)
This PR implements following condition types - StringEqualsIgnoreCase and StringNotEqualsIgnoreCase - BinaryEquals
This commit is contained in:
@@ -24,20 +24,36 @@ import (
|
||||
type name string
|
||||
|
||||
const (
|
||||
stringEquals name = "StringEquals"
|
||||
stringNotEquals = "StringNotEquals"
|
||||
stringLike = "StringLike"
|
||||
stringNotLike = "StringNotLike"
|
||||
ipAddress = "IpAddress"
|
||||
notIPAddress = "NotIpAddress"
|
||||
null = "Null"
|
||||
stringEquals name = "StringEquals"
|
||||
stringNotEquals = "StringNotEquals"
|
||||
stringEqualsIgnoreCase = "StringEqualsIgnoreCase"
|
||||
stringNotEqualsIgnoreCase = "StringNotEqualsIgnoreCase"
|
||||
stringLike = "StringLike"
|
||||
stringNotLike = "StringNotLike"
|
||||
binaryEquals = "BinaryEquals"
|
||||
ipAddress = "IpAddress"
|
||||
notIPAddress = "NotIpAddress"
|
||||
null = "Null"
|
||||
)
|
||||
|
||||
// IsValid - checks if name is valid or not.
|
||||
func (n name) IsValid() bool {
|
||||
switch n {
|
||||
case stringEquals, stringNotEquals, stringLike, stringNotLike, ipAddress, notIPAddress, null:
|
||||
return true
|
||||
for _, supn := range []name{
|
||||
stringEquals,
|
||||
stringNotEquals,
|
||||
stringEqualsIgnoreCase,
|
||||
stringNotEqualsIgnoreCase,
|
||||
binaryEquals,
|
||||
stringLike,
|
||||
stringNotLike,
|
||||
ipAddress,
|
||||
notIPAddress,
|
||||
null,
|
||||
// Add new conditions here.
|
||||
} {
|
||||
if n == supn {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user