Skip to content

Commit 5849e99

Browse files
authored
add notes edge as allowed as some schemas use notes (#2459)
1 parent 7093874 commit 5849e99

7 files changed

Lines changed: 9 additions & 7 deletions

File tree

.task/checksum/generate-ent-smart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
577c22317933c2aa9a19737b4817a7ec
1+
e4e3b3b75c00780d5391eb44d2df9ca4

common/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
)
2222

2323
require (
24-
ariga.io/atlas v1.2.0 // indirect
24+
ariga.io/atlas v1.2.1 // indirect
2525
entgo.io/contrib v0.7.0 // indirect
2626
github.com/99designs/gqlgen v0.17.90 // indirect
2727
github.com/XSAM/otelsql v0.42.0 // indirect

common/go.sum

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
ariga.io/atlas v1.2.0 h1:PJZzG1zTA8SzMR1giJ7XnQe4VjfDWEbJjHnIaK45BFg=
2-
ariga.io/atlas v1.2.0/go.mod h1:vg7qWSatkNqs04Y4Lheg7vR4bGX0wy51Wz4FIMFVr3U=
1+
ariga.io/atlas v1.2.1 h1:xLIs6vThJ2J9Bl8gXFZhXbNyMf4yFuBeJ7AYlZ+Tn6M=
32
entgo.io/contrib v0.7.0 h1:4Ghx8O0rqSMmca3FIJ6QyZbQAoLvdzWqLMl1MbHFEEw=
43
entgo.io/contrib v0.7.0/go.mod h1:zbPSUrbn+6dfyv8S9HWEvn1MyGpO95ik2lUNgaqWTt4=
54
entgo.io/ent v0.14.6 h1:/f2696BpwuWAEEG6PVGWflg6+Inrpq4pRWuNlWz/Skk=
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
45600c6f235c5e04e8519a173f010254a5dfe3052d35b863798e3dedb8b799d2
1+
a0e067a977be32f33c47f1f2864c6096b04ce800c06be050047e3a61d7dd3493
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6ed2de8707b26b2759c6d68d0e17c985fe458dfd4600078d276bcc9d47bdf043
1+
ecf9b08abb255b796fc8f8e372bc29105e6d6ef082991d7b597e6a39cc7dafba

internal/ent/privacy/rule/allow_comments.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"entgo.io/ent"
77

88
"github.com/samber/lo"
9+
910
"github.com/theopenlane/core/internal/ent/generated"
1011
"github.com/theopenlane/core/internal/ent/generated/privacy"
1112
"github.com/theopenlane/core/pkg/slateparser"
@@ -25,7 +26,7 @@ func CheckIfCommentOnly() privacy.MutationRuleFunc {
2526
addedFields := m.AddedFields() // get numeric fields
2627

2728
ignoreFields := []string{"updated_at", "updated_by", "owner_id"}
28-
allowedEdges := []string{"comments"}
29+
allowedEdges := []string{"comments", "notes"}
2930

3031
// remove ignored fields from the list of fields being set in the mutation
3132
fields = lo.Without(fields, ignoreFields...)

internal/ent/schema/entity.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/theopenlane/core/internal/ent/hooks"
2121
"github.com/theopenlane/core/internal/ent/mixin"
2222
"github.com/theopenlane/core/internal/ent/privacy/policy"
23+
"github.com/theopenlane/core/internal/ent/privacy/rule"
2324
"github.com/theopenlane/core/internal/ent/validator"
2425
)
2526

@@ -424,6 +425,7 @@ func (e Entity) Policy() ent.Policy {
424425
return policy.NewPolicy(
425426
policy.WithMutationRules(
426427
policy.CheckCreateAccess(),
428+
rule.CheckIfCommentOnly(),
427429
entfga.CheckEditAccess[*generated.EntityMutation](),
428430
),
429431
)

0 commit comments

Comments
 (0)