mirror of https://github.com/harness/drone.git
feat: [CODE-2426]: Separate CODE Repo Create/Edit into distinct permissions (#2758)
parent
0f3956696c
commit
0a35385255
|
@ -185,7 +185,7 @@ func (c *Controller) spaceCheckAuth(
|
|||
Identifier: "",
|
||||
}
|
||||
|
||||
err = apiauth.Check(ctx, c.authorizer, session, scope, resource, enum.PermissionRepoEdit)
|
||||
err = apiauth.Check(ctx, c.authorizer, session, scope, resource, enum.PermissionRepoCreate)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("auth check failed: %w", err)
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ func (c *Controller) getSpaceCheckAuthRepoCreation(
|
|||
session,
|
||||
space,
|
||||
enum.ResourceTypeRepo,
|
||||
enum.PermissionRepoEdit,
|
||||
enum.PermissionRepoCreate,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("auth check failed: %w", err)
|
||||
|
|
|
@ -46,7 +46,7 @@ func (c *Controller) Restore(
|
|||
return nil, fmt.Errorf("failed to find repository: %w", err)
|
||||
}
|
||||
|
||||
if err = apiauth.CheckRepo(ctx, c.authorizer, session, repo, enum.PermissionRepoEdit); err != nil {
|
||||
if err = apiauth.CheckRepo(ctx, c.authorizer, session, repo, enum.PermissionRepoCreate); err != nil {
|
||||
return nil, fmt.Errorf("access check failed: %w", err)
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ func (c *Controller) ImportRepositories(
|
|||
spaceRef string,
|
||||
in *ImportRepositoriesInput,
|
||||
) (ImportRepositoriesOutput, error) {
|
||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoEdit)
|
||||
space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionRepoCreate)
|
||||
if err != nil {
|
||||
return ImportRepositoriesOutput{}, err
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ var membershipRoleContributorPermissions = slices.Clip(slices.Insert(membershipR
|
|||
))
|
||||
|
||||
var membershipRoleSpaceOwnerPermissions = slices.Clip(slices.Insert(membershipRoleReaderPermissions, 0,
|
||||
PermissionRepoCreate,
|
||||
PermissionRepoEdit,
|
||||
PermissionRepoDelete,
|
||||
PermissionRepoPush,
|
||||
|
|
|
@ -49,6 +49,7 @@ const (
|
|||
----- REPOSITORY -----
|
||||
*/
|
||||
PermissionRepoView Permission = "repo_view"
|
||||
PermissionRepoCreate Permission = "repo_create"
|
||||
PermissionRepoEdit Permission = "repo_edit"
|
||||
PermissionRepoDelete Permission = "repo_delete"
|
||||
PermissionRepoPush Permission = "repo_push"
|
||||
|
|
Loading…
Reference in New Issue