Skip to content

Commit

Permalink
fix(api): permission checks (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
bouassaba authored Nov 28, 2024
1 parent 352cf56 commit e05cae3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions api/service/organization_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ func (svc *OrganizationService) RemoveMember(id string, memberID string, userID
return err
}

if err := svc.orgGuard.Authorize(userID, org, model.PermissionOwner); err != nil {
return err
if memberID != userID {
if err := svc.orgGuard.Authorize(userID, org, model.PermissionOwner); err != nil {
return err
}
}

/* Make sure member is not the last remaining owner of the organization */
Expand Down
2 changes: 1 addition & 1 deletion api/service/workspace_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (svc *WorkspaceService) PatchStorageCapacity(id string, storageCapacity int
if err != nil {
return nil, err
}
if err = svc.workspaceGuard.Authorize(userID, workspace, model.PermissionEditor); err != nil {
if err = svc.workspaceGuard.Authorize(userID, workspace, model.PermissionOwner); err != nil {
return nil, err
}
size, err := svc.fileRepo.ComputeSize(workspace.GetRootID())
Expand Down

0 comments on commit e05cae3

Please sign in to comment.