Skip to content

Commit

Permalink
Everyone can read & create comments
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonF committed Oct 18, 2024
1 parent 608c399 commit 0c1ff27
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
26 changes: 26 additions & 0 deletions dbschema/migrations/00009-m17teec.edgeql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Policy } from '../util';

@Policy('all', (r) => [
// Technically, we want only when the Commentable is readable.
// I think this is sufficient for practical use at this point in time.
...[r.CommentThread, r.Comment].flatMap((it) => it.read.create),
// This shouldn't be needed, but it is. children() needs rewrite.
r.Commentable.children((c) => c.commentThreads.read.create),
])
export class EveryoneCanCommentPolicy {}
1 change: 1 addition & 0 deletions src/components/authorization/policies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ export * from './by-feature/progress-report-media-owner.policy';
export * from './by-feature/project-change-requests-beta.policy';
export * from './by-feature/read-util-objects.policy';
export * from './by-feature/user-can-edit-self.policy';
export * from './by-feature/everyone-can-comment.policy';
export * from './by-feature/user-can-manage-own-comments.policy';
export * from './by-feature/new-progress-reports-beta.policy';

0 comments on commit 0c1ff27

Please sign in to comment.