fix: [CODE-2855]: Use space permissions in labels and rules controllers (#3060)

* Use space permissions in labels and rules controllers
pull/3597/head
Darko Draskovic 2024-11-27 17:22:55 +00:00 committed by Harness
parent 843dc4df5f
commit 1c0e049151
14 changed files with 14 additions and 14 deletions

View File

@ -30,7 +30,7 @@ func (c *Controller) DefineLabel(
spaceRef string,
in *types.DefineLabelInput,
) (*types.Label, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -29,7 +29,7 @@ func (c *Controller) DeleteLabel(
spaceRef string,
key string,
) error {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -30,7 +30,7 @@ func (c *Controller) ListLabels(
spaceRef string,
filter *types.LabelFilter,
) ([]*types.Label, int64, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoView)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceView)
if err != nil {
return nil, 0, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -30,7 +30,7 @@ func (c *Controller) SaveLabel(
spaceRef string,
in *types.SaveInput,
) (*types.LabelWithValues, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -31,7 +31,7 @@ func (c *Controller) UpdateLabel(
key string,
in *types.UpdateLabelInput,
) (*types.Label, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -31,7 +31,7 @@ func (c *Controller) DefineLabelValue(
key string,
in *types.DefineValueInput,
) (*types.LabelValue, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -30,7 +30,7 @@ func (c *Controller) DeleteLabelValue(
key string,
value string,
) error {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -31,7 +31,7 @@ func (c *Controller) ListLabelValues(
key string,
filter *types.ListQueryFilter,
) ([]*types.LabelValue, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoView)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceView)
if err != nil {
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -32,7 +32,7 @@ func (c *Controller) UpdateLabelValue(
value string,
in *types.UpdateValueInput,
) (*types.LabelValue, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -30,7 +30,7 @@ func (c *Controller) RuleCreate(ctx context.Context,
spaceRef string,
in *rules.CreateInput,
) (*types.Rule, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -28,7 +28,7 @@ func (c *Controller) RuleDelete(ctx context.Context,
spaceRef string,
identifier string,
) error {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -29,7 +29,7 @@ func (c *Controller) RuleFind(ctx context.Context,
spaceRef string,
identifier string,
) (*types.Rule, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoView)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceView)
if err != nil {
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -30,7 +30,7 @@ func (c *Controller) RuleList(ctx context.Context,
inherited bool,
filter *types.RuleFilter,
) ([]types.Rule, int64, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoView)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceView)
if err != nil {
return nil, 0, fmt.Errorf("failed to acquire access to space: %w", err)
}

View File

@ -31,7 +31,7 @@ func (c *Controller) RuleUpdate(ctx context.Context,
identifier string,
in *rules.UpdateInput,
) (*types.Rule, error) {
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
if err != nil {
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
}