mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-05 16:06:57 +08:00
Fixed users unlock in ACL LOAD command handler
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@ services:
|
||||
- TLS=false
|
||||
- MTLS=false
|
||||
- BOOTSTRAP_CLUSTER=false
|
||||
# - ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- REQUIRE_PASS=false
|
||||
- PASSWORD=password1
|
||||
- FORWARD_COMMAND=false
|
||||
@@ -69,7 +69,7 @@ services:
|
||||
- TLS=false
|
||||
- MTLS=false
|
||||
- BOOTSTRAP_CLUSTER=true
|
||||
# - ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- REQUIRE_PASS=false
|
||||
- FORWARD_COMMAND=true
|
||||
- SNAPSHOT_THRESHOLD=1000
|
||||
@@ -116,7 +116,7 @@ services:
|
||||
- TLS=false
|
||||
- MTLS=false
|
||||
- BOOTSTRAP_CLUSTER=false
|
||||
# - ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- REQUIRE_PASS=false
|
||||
- FORWARD_COMMAND=true
|
||||
- SNAPSHOT_THRESHOLD=1000
|
||||
@@ -163,7 +163,7 @@ services:
|
||||
- TLS=false
|
||||
- MTLS=false
|
||||
- BOOTSTRAP_CLUSTER=false
|
||||
# - ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- REQUIRE_PASS=false
|
||||
- FORWARD_COMMAND=true
|
||||
- SNAPSHOT_THRESHOLD=1000
|
||||
@@ -210,7 +210,7 @@ services:
|
||||
- TLS=false
|
||||
- MTLS=false
|
||||
- BOOTSTRAP_CLUSTER=false
|
||||
# - ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- REQUIRE_PASS=false
|
||||
- FORWARD_COMMAND=true
|
||||
- SNAPSHOT_THRESHOLD=1000
|
||||
@@ -257,7 +257,7 @@ services:
|
||||
- TLS=false
|
||||
- MTLS=false
|
||||
- BOOTSTRAP_CLUSTER=false
|
||||
# - ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- ACL_CONFIG=/etc/echovault/config/acl.yml
|
||||
- REQUIRE_PASS=false
|
||||
- FORWARD_COMMAND=true
|
||||
- SNAPSHOT_THRESHOLD=1000
|
||||
|
@@ -373,7 +373,7 @@ func handleLoad(params internal.HandlerFuncParams) ([]byte, error) {
|
||||
}
|
||||
|
||||
acl.LockUsers()
|
||||
defer acl.RUnlockUsers()
|
||||
defer acl.UnlockUsers()
|
||||
|
||||
f, err := os.Open(acl.Config.AclConfig)
|
||||
if err != nil {
|
||||
|
@@ -190,6 +190,7 @@ func (user *User) UpdateUser(cmd []string) error {
|
||||
// Parse channels
|
||||
if strings.EqualFold(str, "allChannels") {
|
||||
user.IncludedPubSubChannels = []string{"*"}
|
||||
continue
|
||||
}
|
||||
if len(str) > 2 && str[1] == '&' {
|
||||
if str[0] == '+' {
|
||||
|
68
volumes/config/acl.json
Normal file
68
volumes/config/acl.json
Normal file
@@ -0,0 +1,68 @@
|
||||
[
|
||||
{
|
||||
"Username": "user1",
|
||||
"Enabled": true,
|
||||
"NoPassword": false,
|
||||
"NoKeys": false,
|
||||
"Passwords": [
|
||||
{
|
||||
"PasswordType": "plaintext",
|
||||
"PasswordValue": "password1"
|
||||
},
|
||||
{
|
||||
"PasswordType": "SHA256",
|
||||
"PasswordValue": "6cf615d5bcaac778352a8f1f3360d23f02f34ec182e259897fd6ce485d7870d4"
|
||||
}
|
||||
],
|
||||
"IncludedCategories": [
|
||||
"*"
|
||||
],
|
||||
"ExcludedCategories": [],
|
||||
"IncludedReadKeys": [
|
||||
"*"
|
||||
],
|
||||
"IncludedWriteKeys": [
|
||||
"*"
|
||||
],
|
||||
"IncludedPubSubChannels": [
|
||||
"*"
|
||||
],
|
||||
"ExcludedPubSubChannels": []
|
||||
},
|
||||
{
|
||||
"Username": "user2",
|
||||
"Enabled": true,
|
||||
"NoPassword": false,
|
||||
"NoKeys": false,
|
||||
"Passwords": [
|
||||
{
|
||||
"PasswordType": "plaintext",
|
||||
"PasswordValue": "password4"
|
||||
},
|
||||
{
|
||||
"PasswordType": "SHA256",
|
||||
"PasswordValue": "8b2c86ea9cf2ea4eb517fd1e06b74f399e7fec0fef92e3b482a6cf2e2b092023"
|
||||
}
|
||||
],
|
||||
"IncludedCategories": [
|
||||
"hash",
|
||||
"set",
|
||||
"sortedset",
|
||||
"list",
|
||||
"generic"
|
||||
],
|
||||
"ExcludedCategories": [],
|
||||
"IncludedReadKeys": [
|
||||
"*"
|
||||
],
|
||||
"IncludedWriteKeys": [
|
||||
"*"
|
||||
],
|
||||
"IncludedPubSubChannels": [
|
||||
"user:channel:*"
|
||||
],
|
||||
"ExcludedPubSubChannels": [
|
||||
"admin:channel:*"
|
||||
]
|
||||
}
|
||||
]
|
@@ -0,0 +1,31 @@
|
||||
- Username: "user1"
|
||||
Enabled: true
|
||||
NoPassword: false
|
||||
NoKeys: false
|
||||
Passwords:
|
||||
- PasswordType: "plaintext"
|
||||
PasswordValue: "password1"
|
||||
- PasswordType: "SHA256"
|
||||
PasswordValue: "6cf615d5bcaac778352a8f1f3360d23f02f34ec182e259897fd6ce485d7870d4"
|
||||
IncludedCategories: ["*"]
|
||||
ExcludedCategories: []
|
||||
IncludedReadKeys: ["*"]
|
||||
IncludedWriteKeys: ["*"]
|
||||
IncludedPubSubChannels: ["*"]
|
||||
ExcludedPubSubChannels: []
|
||||
|
||||
- Username: "user2"
|
||||
Enabled: true
|
||||
NoPassword: false
|
||||
NoKeys: false
|
||||
Passwords:
|
||||
- PasswordType: "plaintext"
|
||||
PasswordValue: "password4"
|
||||
- PasswordType: "SHA256"
|
||||
PasswordValue: "8b2c86ea9cf2ea4eb517fd1e06b74f399e7fec0fef92e3b482a6cf2e2b092023"
|
||||
IncludedCategories: ["hash", "set", "sortedset", "list", "generic"]
|
||||
ExcludedCategories: []
|
||||
IncludedReadKeys: ["*"]
|
||||
IncludedWriteKeys: ["*"]
|
||||
IncludedPubSubChannels: ["user:channel:*"]
|
||||
ExcludedPubSubChannels: ["admin:channel:*"]
|
||||
|
Reference in New Issue
Block a user