This commit is contained in:
@@ -62,6 +62,9 @@ func (r *RoleEntity) ToRoleSimple() *RoleSimple {
|
||||
|
||||
func RolesEntityToResponse(rs []*RoleEntity) []*response.RoleResponse {
|
||||
out := make([]*response.RoleResponse, 0)
|
||||
if rs == nil {
|
||||
return out
|
||||
}
|
||||
for _, role := range rs {
|
||||
if role == nil {
|
||||
continue
|
||||
@@ -73,12 +76,15 @@ func RolesEntityToResponse(rs []*RoleEntity) []*response.RoleResponse {
|
||||
|
||||
func RolesEntityToRoleConstant(rs []*RoleSimple) []constants.Role {
|
||||
out := make([]constants.Role, 0)
|
||||
if rs == nil {
|
||||
return out
|
||||
}
|
||||
for _, role := range rs {
|
||||
data, ok := constants.ParseRole(role.Name)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
out= append(out, data)
|
||||
out = append(out, data)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user