3
0

Fix server panic on user export where archived/deleted roles are used

This commit is contained in:
Tomaž Jerman 2023-01-10 12:03:26 +01:00
parent 8b7f903378
commit 843b8b192c

View File

@ -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])