mirror of
https://github.com/minio/minio.git
synced 2025-11-26 04:26:12 -05:00
committed by
Nitish Tiwari
parent
32bd1b31e9
commit
b99aaab42e
@@ -19,22 +19,15 @@ package policy
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
var idRegexp = regexp.MustCompile("^[[:alnum:]]+$")
|
||||
|
||||
// ID - policy ID.
|
||||
type ID string
|
||||
|
||||
// IsValid - checks if ID is valid or not.
|
||||
func (id ID) IsValid() bool {
|
||||
// Allow empty string as ID.
|
||||
if string(id) == "" {
|
||||
return true
|
||||
}
|
||||
|
||||
return idRegexp.MatchString(string(id))
|
||||
return utf8.ValidString(string(id))
|
||||
}
|
||||
|
||||
// MarshalJSON - encodes ID to JSON data.
|
||||
|
||||
Reference in New Issue
Block a user