mirror of
https://github.com/harness/drone.git
synced 2025-04-05 00:11:22 +00:00
Use repo edit and repo view permissions for space label handling (#2569)
* Use repo edit and repo view permissions for space label handling
This commit is contained in:
parent
b83779350d
commit
af6e94ba2c
@ -30,7 +30,7 @@ func (c *Controller) DefineLabel(
|
|||||||
spaceRef string,
|
spaceRef string,
|
||||||
in *types.DefineLabelInput,
|
in *types.DefineLabelInput,
|
||||||
) (*types.Label, error) {
|
) (*types.Label, error) {
|
||||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
|
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func (c *Controller) DeleteLabel(
|
|||||||
spaceRef string,
|
spaceRef string,
|
||||||
key string,
|
key string,
|
||||||
) error {
|
) error {
|
||||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
|
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to acquire access to space: %w", err)
|
return fmt.Errorf("failed to acquire access to space: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func (c *Controller) ListLabels(
|
|||||||
spaceRef string,
|
spaceRef string,
|
||||||
filter *types.LabelFilter,
|
filter *types.LabelFilter,
|
||||||
) ([]*types.Label, int64, error) {
|
) ([]*types.Label, int64, error) {
|
||||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceView)
|
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoView)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, fmt.Errorf("failed to acquire access to space: %w", err)
|
return nil, 0, fmt.Errorf("failed to acquire access to space: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func (c *Controller) SaveLabel(
|
|||||||
spaceRef string,
|
spaceRef string,
|
||||||
in *types.SaveInput,
|
in *types.SaveInput,
|
||||||
) (*types.LabelWithValues, error) {
|
) (*types.LabelWithValues, error) {
|
||||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
|
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ func (c *Controller) UpdateLabel(
|
|||||||
key string,
|
key string,
|
||||||
in *types.UpdateLabelInput,
|
in *types.UpdateLabelInput,
|
||||||
) (*types.Label, error) {
|
) (*types.Label, error) {
|
||||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
|
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ func (c *Controller) DefineLabelValue(
|
|||||||
in *types.DefineValueInput,
|
in *types.DefineValueInput,
|
||||||
) (*types.LabelValue, error) {
|
) (*types.LabelValue, error) {
|
||||||
// TODO: permission check should be based on static vs dynamic label
|
// TODO: permission check should be based on static vs dynamic label
|
||||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
|
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func (c *Controller) DeleteLabelValue(
|
|||||||
key string,
|
key string,
|
||||||
value string,
|
value string,
|
||||||
) error {
|
) error {
|
||||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
|
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to acquire access to space: %w", err)
|
return fmt.Errorf("failed to acquire access to space: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ func (c *Controller) ListLabelValues(
|
|||||||
key string,
|
key string,
|
||||||
filter *types.ListQueryFilter,
|
filter *types.ListQueryFilter,
|
||||||
) ([]*types.LabelValue, error) {
|
) ([]*types.LabelValue, error) {
|
||||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceView)
|
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoView)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ func (c *Controller) UpdateLabelValue(
|
|||||||
value string,
|
value string,
|
||||||
in *types.UpdateValueInput,
|
in *types.UpdateValueInput,
|
||||||
) (*types.LabelValue, error) {
|
) (*types.LabelValue, error) {
|
||||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceEdit)
|
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
return nil, fmt.Errorf("failed to acquire access to space: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user