fix: (rbac) menu permission
This commit is contained in:
parent
8d730834dd
commit
2e939cee70
|
@ -40,10 +40,10 @@ type ConsolePermisson struct {
|
||||||
Menu []Menu `json:"menu"`
|
Menu []Menu `json:"menu"`
|
||||||
}
|
}
|
||||||
type Menu struct {
|
type Menu struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Switch []string `json:"switch,omitempty"`
|
Permission []string `json:"permission,omitempty"`
|
||||||
Children []Menu `json:"children,omitempty"`
|
Children []Menu `json:"children,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ConsoleRole) ListPermission() interface{} {
|
func (r ConsoleRole) ListPermission() interface{} {
|
||||||
|
@ -68,20 +68,20 @@ func (r ConsoleRole) ListPermission() interface{} {
|
||||||
Name: "平台管理",
|
Name: "平台管理",
|
||||||
Children: []Menu{
|
Children: []Menu{
|
||||||
{
|
{
|
||||||
Id: "cluster_overview",
|
Id: "cluster_overview",
|
||||||
Name: "平台概览",
|
Name: "平台概览",
|
||||||
Switch: []string{"none", "write", "read"},
|
Permission: []string{"none", "write", "read"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
Id: "cluster_elasticsearch",
|
Id: "cluster_elasticsearch",
|
||||||
Name: "集群监控",
|
Name: "集群监控",
|
||||||
Switch: []string{"none", "write", "read"},
|
Permission: []string{"none", "write", "read"},
|
||||||
}, {
|
}, {
|
||||||
|
|
||||||
Id: "cluster_activities",
|
Id: "cluster_activities",
|
||||||
Name: "集群动态",
|
Name: "集群动态",
|
||||||
Switch: []string{"none", "write", "read"},
|
Permission: []string{"none", "write", "read"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,9 +18,9 @@ type ConsolePermission struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Menu struct {
|
type Menu struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Switch string `json:"switch"`
|
Permission string `json:"permission"`
|
||||||
}
|
}
|
||||||
type ElasticsearchPermission struct {
|
type ElasticsearchPermission struct {
|
||||||
Cluster []string `json:"cluster" elastic_mapping:"cluster:{type:object}"`
|
Cluster []string `json:"cluster" elastic_mapping:"cluster:{type:object}"`
|
||||||
|
|
|
@ -3,8 +3,6 @@ package rbac
|
||||||
import (
|
import (
|
||||||
log "github.com/cihub/seelog"
|
log "github.com/cihub/seelog"
|
||||||
"infini.sh/console/internal/biz"
|
"infini.sh/console/internal/biz"
|
||||||
"infini.sh/console/internal/core"
|
|
||||||
|
|
||||||
httprouter "infini.sh/framework/core/api/router"
|
httprouter "infini.sh/framework/core/api/router"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
@ -19,8 +17,6 @@ func (h Rbac) ListPermission(w http.ResponseWriter, r *http.Request, ps httprout
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
permissions := role.ListPermission()
|
permissions := role.ListPermission()
|
||||||
h.WriteOKJSON(w, core.Response{
|
h.WriteOKJSON(w, permissions)
|
||||||
Hit: permissions,
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue