mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-01 05:28:26 +01:00
fixes robot account list permission issue (#13792)
fixes #13786, do not add the removed project into the permission list of a system level robot account. Signed-off-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
parent
792dcc4ac3
commit
dfe678457f
@ -259,12 +259,16 @@ func (d *controller) populatePermissions(ctx context.Context, r *Robot) error {
|
|||||||
|
|
||||||
var permissions []*Permission
|
var permissions []*Permission
|
||||||
for scope, accesses := range accessMap {
|
for scope, accesses := range accessMap {
|
||||||
p := &Permission{}
|
|
||||||
kind, namespace, err := d.convertScope(ctx, scope)
|
kind, namespace, err := d.convertScope(ctx, scope)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// if the project is removed, do not list it in the robot account permission.
|
||||||
|
if errors.IsNotFoundErr(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
log.Errorf("failed to decode scope of robot %d: %v", r.ID, err)
|
log.Errorf("failed to decode scope of robot %d: %v", r.ID, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
p := &Permission{}
|
||||||
p.Scope = scope
|
p.Scope = scope
|
||||||
p.Kind = kind
|
p.Kind = kind
|
||||||
p.Namespace = namespace
|
p.Namespace = namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user