doc/privacy: initial version for privacy feature (#843)

This commit is contained in:
Ariel Mashraki
2020-10-13 10:29:41 +03:00
committed by GitHub
parent d3849f9eb7
commit 02acd17c14
40 changed files with 6917 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
# Privacy Admin Example
# Privacy Admin Only Example
An example for an application that allows any user to read any data,
but accepts mutations only from viewers with admin role.

View File

@@ -27,12 +27,12 @@ func (User) Fields() []ent.Field {
// Policy defines the privacy policy of the User.
func (User) Policy() ent.Policy {
return privacy.Policy{
Mutation: []privacy.MutationRule{
Mutation: privacy.MutationPolicy{
rule.DenyIfNoViewer(),
rule.AllowIfAdmin(),
privacy.AlwaysDenyRule(),
},
Query: []privacy.QueryRule{
Query: privacy.QueryPolicy{
privacy.AlwaysAllowRule(),
},
}