feat: [pipe-25436]: restrict user from updating harness-filestore repo (#3472)

* feat: [pipe-25436]: restrict user from updating harness-filestore repo
This commit is contained in:
Karan Saraswat 2025-02-24 06:47:36 +00:00 committed by Harness
parent f237a1f256
commit 3a1348893d

View File

@ -98,6 +98,10 @@ func (c *Controller) Update(ctx context.Context,
return nil, fmt.Errorf("failed to sanitize input: %w", err)
}
if err = c.repoCheck.LifecycleRestriction(ctx, session, repoCore); err != nil {
return nil, err
}
if in.State != nil &&
!slices.Contains(allowedRepoStateTransitions[repo.State], *in.State) {
return nil, usererror.BadRequestf("Changing the state of a repository from %s to %s is not allowed.",