- 重构authz结构

- 角色管理初版完成
This commit is contained in:
gazebo
2019-08-08 17:06:58 +08:00
parent 60f3ec9c3b
commit b51614946f
18 changed files with 161 additions and 98 deletions

View File

@@ -2,6 +2,7 @@ package casbinauth
import (
"git.rosy.net.cn/jx-callback/business/authz"
"git.rosy.net.cn/jx-callback/business/authz/autils"
"git.rosy.net.cn/jx-callback/globals"
"github.com/casbin/casbin"
)
@@ -29,7 +30,7 @@ func (c *CasbinAuthz) DeleteRole4User(userID string, r *authz.RoleInfo) (err err
func (c *CasbinAuthz) GetUserRoleList(userID string) (roleList []*authz.RoleInfo, err error) {
roleNameList, err := c.enforcer.GetRolesForUser(userID)
if err == nil && len(roleNameList) > 0 {
roleList = authz.FullRoleName2RoleList(roleNameList)
roleList = autils.FullRoleName2RoleList(roleNameList)
}
return roleList, err
}