mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-09-25 20:56:40 +08:00
Update context.go
新增多角色
This commit is contained in:
parent
f78f44e00f
commit
4594cc3b7e
@ -78,22 +78,22 @@ func GetUserId(ctx context.Context) int64 {
|
|||||||
return user.Id
|
return user.Id
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRoleId 获取用户角色ID
|
// GetRoleIds 获取用户所有角色ID
|
||||||
func GetRoleId(ctx context.Context) int64 {
|
func GetRoleIds(ctx context.Context) []int64 {
|
||||||
user := GetUser(ctx)
|
user := GetUser(ctx)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
return 0
|
return nil
|
||||||
}
|
}
|
||||||
return user.RoleId
|
return user.RoleIds
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRoleKey 获取用户角色唯一编码
|
// GetRoleKey 获取用户所有角色编码
|
||||||
func GetRoleKey(ctx context.Context) string {
|
func GetRoleKey(ctx context.Context) []string {
|
||||||
user := GetUser(ctx)
|
user := GetUser(ctx)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
return ""
|
return nil
|
||||||
}
|
}
|
||||||
return user.RoleKey
|
return user.RoleKeys
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDeptType 获取用户部门类型
|
// GetDeptType 获取用户部门类型
|
||||||
|
Loading…
Reference in New Issue
Block a user