mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
Token service handling invalid resource (#12790)
This commit updates the way token service handles invalid resource, for example a resource without projectname. It will clear the requested access instead of returning 500 error. Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
parent
89b597a811
commit
77281ca68b
@ -94,7 +94,9 @@ func filterAccess(access []*token.ResourceActions, ctx security.Context,
|
||||
err = f.filter(ctx, pm, a)
|
||||
log.Debugf("user: %s, access: %v", ctx.GetUsername(), a)
|
||||
if err != nil {
|
||||
return err
|
||||
log.Errorf("Failed to handle the resource %s:%s, due to error %v, returning empty access for it.",
|
||||
a.Type, a.Name, err)
|
||||
a.Actions = []string{}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user