Skip to content

Commit b6524ec

Browse files
committed
fix: invert permission condition check
1 parent 58bac16 commit b6524ec

11 files changed

Lines changed: 11 additions & 11 deletions

src/Application/Boards/ChangeOrder/ChangeBoardOrderCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task<Result> Handle(ChangeBoardOrderCommand request, CancellationTo
2323
}
2424

2525
bool hasAccess = await userAccess.IsAuthenticatedAsync(board.Project.Workspace.Id, Role.Owner);
26-
if (hasAccess)
26+
if (!hasAccess)
2727
{
2828
return Result.Failure(BoardErrors.NotFound(request.BoardId));
2929
}

src/Application/Boards/Delete/DeleteBoardCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public async Task<Result> Handle(DeleteBoardCommand request, CancellationToken c
2424
return Result.Failure(BoardErrors.NotFound(request.boardId));
2525
}
2626
bool hasAccess = await userAccess.IsAuthenticatedAsync(board.Project.Workspace.Id, Role.Owner);
27-
if (hasAccess)
27+
if (!hasAccess)
2828
{
2929
return Result.Failure(BoardErrors.NotFound(request.boardId));
3030
}

src/Application/Boards/GetById/GetBoardByIdQueryHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task<Result<BoardResponse>> Handle(GetBoardByIdQuery request, Cance
2121
.SingleOrDefaultAsync(cancellationToken);
2222

2323
bool hasAccess = await userAccess.IsAuthenticatedAsync(workspaceId);
24-
if (hasAccess)
24+
if (!hasAccess)
2525
{
2626
return Result.Failure<BoardResponse>(BoardErrors.NotFound(request.BoardId));
2727
}

src/Application/Boards/Update/UpdateBoardCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public async Task<Result> Handle(UpdateBoardCommand request, CancellationToken c
2222
return Result.Failure(BoardErrors.NotFound(request.BoardId));
2323
}
2424
bool hasAccess = await userAccess.IsAuthenticatedAsync(board.Project.Workspace.Id);
25-
if (hasAccess)
25+
if (!hasAccess)
2626
{
2727
return Result.Failure(BoardErrors.NotFound(request.BoardId));
2828
}

src/Application/Comments/Delete/DeleteCommentCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public async Task<Result> Handle(DeleteCommentCommand request, CancellationToken
2424
return Result.Failure(CommentErrors.NotFound(request.CommentId));
2525
}
2626
bool hasAccess = await userAccess.IsAuthenticatedAsync(comment.Task.Board.Project.Workspace.Id);
27-
if (hasAccess)
27+
if (!hasAccess)
2828
{
2929
return Result.Failure(CommentErrors.NotFound(request.CommentId));
3030
}

src/Application/Comments/Update/UpdateCommentCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task<Result> Handle(UpdateCommentCommand request, CancellationToken
2323
return Result.Failure(CommentErrors.NotFound(request.CommentId));
2424
}
2525
bool hasAccess = await userAccess.IsAuthenticatedAsync(comment.Task.Board.Project.Workspace.Id);
26-
if (hasAccess)
26+
if (!hasAccess)
2727
{
2828
return Result.Failure(CommentErrors.NotFound(request.CommentId));
2929
}

src/Application/Projects/Delete/DeleteProjectCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public async Task<Result> Handle(DeleteProjectCommand request, CancellationToken
2626
}
2727

2828
bool hasAccess = await userAccess.IsAuthenticatedAsync(project.Workspace.Id);
29-
if (hasAccess)
29+
if (!hasAccess)
3030
{
3131
return Result.Failure(ProjectErrors.NotFound(request.ProjectId));
3232
}

src/Application/Projects/Get/GetProjectsQueryHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal sealed class GetProjectsQueryHandler(
1313
public async Task<Result<List<ProjectResponse>>> Handle(GetProjectsQuery request, CancellationToken cancellationToken)
1414
{
1515
bool hasAccess = await userAccess.IsAuthenticatedAsync(request.WorkspaceId);
16-
if (hasAccess)
16+
if (!hasAccess)
1717
{
1818
return Result.Failure<List<ProjectResponse>>(WorkspaceErrors.NotFound(request.WorkspaceId));
1919
}

src/Application/Projects/GetById/GetProjectByIdQueryHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task<Result<ProjectResponse>> Handle(GetProjectByIdQuery request, C
2323
}
2424

2525
bool hasAccess = await userAccess.IsAuthenticatedAsync(project.Workspace.Id);
26-
if (hasAccess)
26+
if (!hasAccess)
2727
{
2828
return Result.Failure<ProjectResponse>(ProjectErrors.NotFound(request.ProjectId));
2929
}

src/Application/Projects/Update/UpdateProjectCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public async Task<Result<Result>> Handle(UpdateProjectCommand request, Cancellat
2222
}
2323

2424
bool hasAccess = await userAccess.IsAuthenticatedAsync(project.Workspace.Id);
25-
if (hasAccess)
25+
if (!hasAccess)
2626
{
2727
return Result.Failure(ProjectErrors.NotFound(request.ProjectId));
2828
}

0 commit comments

Comments
 (0)