mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-19 22:34:40 +08:00
Added resetpass, nocommands, resetkeys and resetchannels directives in ACL DSL
This commit is contained in:
@@ -8,6 +8,7 @@ type User struct {
|
||||
Username string `json:"Username" yaml:"Username"`
|
||||
Enabled bool `json:"Enabled" yaml:"Enabled"`
|
||||
NoPassword bool `json:"NoPassword" yaml:"NoPassword"`
|
||||
NoKeys bool `json:"NoKeys" yaml:"NoKeys"`
|
||||
|
||||
Passwords []Password `json:"Passwords" yaml:"Passwords"`
|
||||
|
||||
@@ -33,21 +34,24 @@ func (user *User) Normalise() {
|
||||
}
|
||||
|
||||
user.IncludedCommands = RemoveDuplicateEntries(user.IncludedCommands, "allCommands")
|
||||
if len(user.IncludedCommands) == 0 {
|
||||
user.IncludedCommands = []string{"*"}
|
||||
}
|
||||
user.ExcludedCommands = RemoveDuplicateEntries(user.ExcludedCommands, "allCommands")
|
||||
if utils.Contains(user.ExcludedCommands, "*") {
|
||||
user.IncludedCommands = []string{}
|
||||
}
|
||||
|
||||
user.IncludedKeys = RemoveDuplicateEntries(user.IncludedKeys, "allKeys")
|
||||
if len(user.IncludedKeys) == 0 {
|
||||
if len(user.IncludedKeys) == 0 && !user.NoKeys {
|
||||
user.IncludedKeys = []string{"*"}
|
||||
}
|
||||
user.IncludedReadKeys = RemoveDuplicateEntries(user.IncludedReadKeys, "allKeys")
|
||||
if len(user.IncludedReadKeys) == 0 {
|
||||
if len(user.IncludedReadKeys) == 0 && !user.NoKeys {
|
||||
user.IncludedReadKeys = []string{"*"}
|
||||
}
|
||||
user.IncludedWriteKeys = RemoveDuplicateEntries(user.IncludedWriteKeys, "allKeys")
|
||||
if len(user.IncludedWriteKeys) == 0 {
|
||||
if len(user.IncludedWriteKeys) == 0 && !user.NoKeys {
|
||||
user.IncludedWriteKeys = []string{"*"}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user