1
This commit is contained in:
parent
b202ae5010
commit
be7c1c1278
@ -152,14 +152,25 @@ func (this *PermissionTable) loadPermission() {
|
||||
|
||||
func (this *PermissionTable) loadRole() {
|
||||
roles := []string{}
|
||||
if jsonStr, err := f5.ReadJsonFile("../config/roles.json"); err == nil {
|
||||
if err := q5.DecodeJson(jsonStr, &roles); err == nil {
|
||||
|
||||
{
|
||||
if jsonStr, err := f5.ReadJsonFile("../config/roles.json"); err == nil {
|
||||
if err := q5.DecodeJson(jsonStr, &roles); err != nil {
|
||||
panic(fmt.Sprintf("parse metafile error %s %s", "roles.json", err))
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("parse metafile error %s %s", "roles.json", err))
|
||||
panic(fmt.Sprintf("load metafile error %s %s", "roles.json", err))
|
||||
}
|
||||
}
|
||||
for _, role := range roles {
|
||||
if jsonStr, err := f5.ReadJsonFile("../config/role/" + role + ".json"); err == nil {
|
||||
rolePermission := struct{
|
||||
Api []string `json:"api"`
|
||||
Ui []string `json:"ui"`
|
||||
}{}
|
||||
if err := q5.DecodeJson(jsonStr, &rolePermission); err != nil {
|
||||
panic(fmt.Sprintf("parse role metafile error %s %s", role + ".json", err))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("load metafile error %s %s", "roles.json", err))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user