Fix server panic on user export where archived/deleted roles are used
This commit is contained in:
parent
8b7f903378
commit
843b8b192c
@ -385,6 +385,13 @@ func (ctrl *User) Export(ctx context.Context, r *request.UserExport) (rsp interf
|
||||
|
||||
for _, m := range membership {
|
||||
if _, ok := roleResIndex[m.RoleID]; !ok {
|
||||
// If it's not here then it was probably deleted/archived
|
||||
// @todo consider adding a flag to control what happens on
|
||||
// archived/deleted resources
|
||||
if _, ok := roleIndex[m.RoleID]; !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
roleResIndex[m.RoleID] = resource.NewRole(roleIndex[m.RoleID])
|
||||
if r.InclRoles {
|
||||
resources = append(resources, roleResIndex[m.RoleID])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user