mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Refactor and reformat userConfig
This commit is contained in:
parent
fc260b2291
commit
b637ddeb28
@ -24,9 +24,9 @@ var (
|
|||||||
type UserCfgRepo struct {
|
type UserCfgRepo struct {
|
||||||
DB *sqlx.DB
|
DB *sqlx.DB
|
||||||
Lookup *sqlx.Stmt
|
Lookup *sqlx.Stmt
|
||||||
lock sync.RWMutex
|
|
||||||
uiDefaults map[string]interface{}
|
uiDefaults map[string]interface{}
|
||||||
cache *lrucache.Cache
|
cache *lrucache.Cache
|
||||||
|
lock sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUserCfgRepo() *UserCfgRepo {
|
func GetUserCfgRepo() *UserCfgRepo {
|
||||||
@ -112,8 +112,8 @@ func (uCfg *UserCfgRepo) GetUIConfig(user *schema.User) (map[string]interface{},
|
|||||||
// configuration.
|
// configuration.
|
||||||
func (uCfg *UserCfgRepo) UpdateConfig(
|
func (uCfg *UserCfgRepo) UpdateConfig(
|
||||||
key, value string,
|
key, value string,
|
||||||
user *schema.User) error {
|
user *schema.User,
|
||||||
|
) error {
|
||||||
if user == nil {
|
if user == nil {
|
||||||
var val interface{}
|
var val interface{}
|
||||||
if err := json.Unmarshal([]byte(value), &val); err != nil {
|
if err := json.Unmarshal([]byte(value), &val); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user