Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
EVEREST-832 Refactor validateBackupStoragesAccess
Browse files Browse the repository at this point in the history
Co-authored-by: Oksana Grishchenko <[email protected]>
  • Loading branch information
recharte and oksana-grishchenko authored Feb 12, 2024
1 parent 95cc3fe commit 57749c5
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions api/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,18 +613,12 @@ func (e *EverestServer) validateBackupStoragesAccess(ctx context.Context, namesp
return nil, fmt.Errorf("could not validate backup storage %s", name)
}

found := false
for _, ns := range bs.Spec.TargetNamespaces {
if ns == namespace {
found = true
break
return bs, nil
}
}
if !found {
return nil, fmt.Errorf("backup storage %s is not allowed for namespace %s", name, namespace)
}

return bs, nil
return nil, fmt.Errorf("backup storage %s is not allowed for namespace %s", name, namespace)
}

func (e *EverestServer) validateMonitoringConfigAccess(ctx context.Context, namespace, name string) (*everestv1alpha1.MonitoringConfig, error) {
Expand Down

0 comments on commit 57749c5

Please sign in to comment.