Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .task/checksum/generate-ent-smart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
577c22317933c2aa9a19737b4817a7ec
e4e3b3b75c00780d5391eb44d2df9ca4
2 changes: 1 addition & 1 deletion common/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
)

require (
ariga.io/atlas v1.2.0 // indirect
ariga.io/atlas v1.2.1 // indirect
entgo.io/contrib v0.7.0 // indirect
github.com/99designs/gqlgen v0.17.90 // indirect
github.com/XSAM/otelsql v0.42.0 // indirect
Expand Down
3 changes: 1 addition & 2 deletions common/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ariga.io/atlas v1.2.0 h1:PJZzG1zTA8SzMR1giJ7XnQe4VjfDWEbJjHnIaK45BFg=
ariga.io/atlas v1.2.0/go.mod h1:vg7qWSatkNqs04Y4Lheg7vR4bGX0wy51Wz4FIMFVr3U=
ariga.io/atlas v1.2.1 h1:xLIs6vThJ2J9Bl8gXFZhXbNyMf4yFuBeJ7AYlZ+Tn6M=
entgo.io/contrib v0.7.0 h1:4Ghx8O0rqSMmca3FIJ6QyZbQAoLvdzWqLMl1MbHFEEw=
entgo.io/contrib v0.7.0/go.mod h1:zbPSUrbn+6dfyv8S9HWEvn1MyGpO95ik2lUNgaqWTt4=
entgo.io/ent v0.14.6 h1:/f2696BpwuWAEEG6PVGWflg6+Inrpq4pRWuNlWz/Skk=
Expand Down
2 changes: 1 addition & 1 deletion internal/ent/checksum/.history_schema_checksum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
45600c6f235c5e04e8519a173f010254a5dfe3052d35b863798e3dedb8b799d2
a0e067a977be32f33c47f1f2864c6096b04ce800c06be050047e3a61d7dd3493
2 changes: 1 addition & 1 deletion internal/ent/checksum/.schema_checksum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6ed2de8707b26b2759c6d68d0e17c985fe458dfd4600078d276bcc9d47bdf043
ecf9b08abb255b796fc8f8e372bc29105e6d6ef082991d7b597e6a39cc7dafba
3 changes: 2 additions & 1 deletion internal/ent/privacy/rule/allow_comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"entgo.io/ent"

"github.com/samber/lo"

"github.com/theopenlane/core/internal/ent/generated"
"github.com/theopenlane/core/internal/ent/generated/privacy"
"github.com/theopenlane/core/pkg/slateparser"
Expand All @@ -25,7 +26,7 @@ func CheckIfCommentOnly() privacy.MutationRuleFunc {
addedFields := m.AddedFields() // get numeric fields

ignoreFields := []string{"updated_at", "updated_by", "owner_id"}
allowedEdges := []string{"comments"}
allowedEdges := []string{"comments", "notes"}

// remove ignored fields from the list of fields being set in the mutation
fields = lo.Without(fields, ignoreFields...)
Expand Down
2 changes: 2 additions & 0 deletions internal/ent/schema/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/theopenlane/core/internal/ent/hooks"
"github.com/theopenlane/core/internal/ent/mixin"
"github.com/theopenlane/core/internal/ent/privacy/policy"
"github.com/theopenlane/core/internal/ent/privacy/rule"
"github.com/theopenlane/core/internal/ent/validator"
)

Expand Down Expand Up @@ -424,6 +425,7 @@ func (e Entity) Policy() ent.Policy {
return policy.NewPolicy(
policy.WithMutationRules(
policy.CheckCreateAccess(),
rule.CheckIfCommentOnly(),
entfga.CheckEditAccess[*generated.EntityMutation](),
),
)
Expand Down