mirror of
https://github.com/outline/outline.git
synced 2026-01-07 19:49:58 -06:00
fix: Viewers cannot delete their own comments
This commit is contained in:
@@ -2,7 +2,7 @@ import { Comment, User, Team } from "@server/models";
|
||||
import { allow } from "./cancan";
|
||||
|
||||
allow(User, "createComment", Team, (user, team) => {
|
||||
if (!team || user.isViewer || user.teamId !== team.id) {
|
||||
if (!team || user.teamId !== team.id) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -12,8 +12,5 @@ allow(User, ["read", "update", "delete"], Comment, (user, comment) => {
|
||||
if (!comment) {
|
||||
return false;
|
||||
}
|
||||
if (user.isViewer) {
|
||||
return false;
|
||||
}
|
||||
return user?.id === comment.createdById;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user