Skip to content

Commit de8a8c3

Browse files
committed
fix: missing grants in userconf
1 parent 792af14 commit de8a8c3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎ckconfig/users.go‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package ckconfig
22

33
import (
4+
"fmt"
5+
46
"github.com/housepower/ckman/common"
57
"github.com/housepower/ckman/model"
68
"github.com/imdario/mergo"
@@ -39,6 +41,11 @@ func users(conf *model.CKManClickHouseConfig) map[string]interface{} {
3941
normal[common.CkPasswdLabel(normalUser.EncryptType)] = common.CkPassword(normalUser.Password, normalUser.EncryptType)
4042
normal["profile"] = common.GetStringwithDefault(normalUser.Profile, model.ClickHouseUserProfileDefault)
4143
normal["quota"] = common.GetStringwithDefault(normalUser.Quota, model.ClickHouseUserQuotaDefault)
44+
if normalUser.Roles != "" {
45+
normal["grants"] = map[string]interface{}{
46+
"query": fmt.Sprintf("GRANT %s", normalUser.Roles),
47+
}
48+
}
4249
networks := make(map[string]interface{})
4350
if len(normalUser.Networks.IPs) > 0 {
4451
var ips []string

0 commit comments

Comments
 (0)