mirror of
https://github.com/bmc-toolbox/bmclib.git
synced 2025-06-03 05:14:43 +00:00
internal/utils: purge unused methods
This commit is contained in:
parent
e884fddfdc
commit
ddd4b423b5
@ -1,10 +1,7 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"unicode"
|
||||
|
||||
"github.com/bmc-toolbox/bmclib/cfgresources"
|
||||
)
|
||||
|
||||
// IsntLetterOrNumber check if the give rune is not a letter nor a number
|
||||
@ -16,27 +13,6 @@ func IsRoleValid(role string) bool {
|
||||
return role == "admin" || role == "user" || role == "operator"
|
||||
}
|
||||
|
||||
func ValidateUserConfig(cfgUsers []*cfgresources.User) (err error) {
|
||||
for _, cfgUser := range cfgUsers {
|
||||
if cfgUser.Name == "" {
|
||||
msg := "User resource expects parameter: Name."
|
||||
return errors.New(msg)
|
||||
}
|
||||
|
||||
if cfgUser.Password == "" {
|
||||
msg := "User resource expects parameter: Password."
|
||||
return errors.New(msg)
|
||||
}
|
||||
|
||||
if !IsRoleValid(cfgUser.Role) {
|
||||
msg := "Parameter \"Role\" is one of ['admin', 'user']. You sent " + cfgUser.Role
|
||||
return errors.New(msg + "!")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func StringInSlice(str string, sl []string) bool {
|
||||
for _, s := range sl {
|
||||
if str == s {
|
||||
|
Loading…
Reference in New Issue
Block a user