Skip to content

Commit 9424977

Browse files
committed
added functionallity for teachers to delete all posts
1 parent 30cb2a6 commit 9424977

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exercise.wwwapi/Endpoints/PostEndpoints.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public static async Task<IResult> DeletePost(IRepository<Post> postRepository, i
224224
return TypedResults.NotFound();
225225
}
226226

227-
if (post.AuthorId != userIdClaim)
227+
if (post.AuthorId != userIdClaim && !claimsPrincipal.IsInRole("Teacher"))
228228
{
229229
return Results.Unauthorized();
230230
}

0 commit comments

Comments
 (0)