Documentation ¶
Index ¶
- Variables
- func Allowf(format string, a ...any) error
- func DecisionContext(parent context.Context, decision error) context.Context
- func DecisionFromContext(ctx context.Context) (error, bool)
- func Denyf(format string, a ...any) error
- func Skipf(format string, a ...any) error
- type AccountMutationRuleFunc
- type AccountQueryRuleFunc
- type BlobLinkMutationRuleFunc
- type BlobLinkQueryRuleFunc
- type BlobMutationRuleFunc
- type BlobQueryRuleFunc
- type CarMutationRuleFunc
- type CarQueryRuleFunc
- type DeviceMutationRuleFunc
- type DeviceQueryRuleFunc
- type DocMutationRuleFunc
- type DocQueryRuleFunc
- type Filter
- type FilterFunc
- type GroupMutationRuleFunc
- type GroupQueryRuleFunc
- type IntSIDMutationRuleFunc
- type IntSIDQueryRuleFunc
- type LinkMutationRuleFunc
- type LinkQueryRuleFunc
- type MixinIDMutationRuleFunc
- type MixinIDQueryRuleFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type NoteMutationRuleFunc
- type NoteQueryRuleFunc
- type OtherMutationRuleFunc
- type OtherQueryRuleFunc
- type PetMutationRuleFunc
- type PetQueryRuleFunc
- type Policy
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
- type RevisionMutationRuleFunc
- type RevisionQueryRuleFunc
- type SessionMutationRuleFunc
- type SessionQueryRuleFunc
- type TokenMutationRuleFunc
- type TokenQueryRuleFunc
- type UserMutationRuleFunc
- type UserQueryRuleFunc
Constants ¶
This section is empty.
Variables ¶
var ( // Allow may be returned by rules to indicate that the policy // evaluation should terminate with allow decision. Allow = privacy.Allow // Deny may be returned by rules to indicate that the policy // evaluation should terminate with deny decision. Deny = privacy.Deny // Skip may be returned by rules to indicate that the policy // evaluation should continue to the next rule. Skip = privacy.Skip )
Functions ¶
func DecisionContext ¶
DecisionContext creates a new context from the given parent context with a policy decision attach to it.
func DecisionFromContext ¶
DecisionFromContext retrieves the policy decision from the context.
Types ¶
type AccountMutationRuleFunc ¶
type AccountMutationRuleFunc func(context.Context, *ent.AccountMutation) error
The AccountMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (AccountMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type AccountQueryRuleFunc ¶
type AccountQueryRuleFunc func(context.Context, *ent.AccountQuery) error
The AccountQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type BlobLinkMutationRuleFunc ¶
type BlobLinkMutationRuleFunc func(context.Context, *ent.BlobLinkMutation) error
The BlobLinkMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (BlobLinkMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type BlobLinkQueryRuleFunc ¶
type BlobLinkQueryRuleFunc func(context.Context, *ent.BlobLinkQuery) error
The BlobLinkQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type BlobMutationRuleFunc ¶
type BlobMutationRuleFunc func(context.Context, *ent.BlobMutation) error
The BlobMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (BlobMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type BlobQueryRuleFunc ¶
The BlobQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type CarMutationRuleFunc ¶
type CarMutationRuleFunc func(context.Context, *ent.CarMutation) error
The CarMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (CarMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type CarQueryRuleFunc ¶
The CarQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type DeviceMutationRuleFunc ¶
type DeviceMutationRuleFunc func(context.Context, *ent.DeviceMutation) error
The DeviceMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (DeviceMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type DeviceQueryRuleFunc ¶
type DeviceQueryRuleFunc func(context.Context, *ent.DeviceQuery) error
The DeviceQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type DocMutationRuleFunc ¶
type DocMutationRuleFunc func(context.Context, *ent.DocMutation) error
The DocMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (DocMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type DocQueryRuleFunc ¶
The DocQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type Filter ¶
Filter is the interface that wraps the Where function for filtering nodes in queries and mutations.
type FilterFunc ¶
The FilterFunc type is an adapter that allows the use of ordinary functions as filters for query and mutation types.
func (FilterFunc) EvalMutation ¶
EvalMutation calls f(ctx, q) if the mutation implements the Filter interface, otherwise it is denied.
type GroupMutationRuleFunc ¶
type GroupMutationRuleFunc func(context.Context, *ent.GroupMutation) error
The GroupMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (GroupMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type GroupQueryRuleFunc ¶
type GroupQueryRuleFunc func(context.Context, *ent.GroupQuery) error
The GroupQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type IntSIDMutationRuleFunc ¶
type IntSIDMutationRuleFunc func(context.Context, *ent.IntSIDMutation) error
The IntSIDMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (IntSIDMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type IntSIDQueryRuleFunc ¶
type IntSIDQueryRuleFunc func(context.Context, *ent.IntSIDQuery) error
The IntSIDQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type LinkMutationRuleFunc ¶ added in v0.11.3
type LinkMutationRuleFunc func(context.Context, *ent.LinkMutation) error
The LinkMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (LinkMutationRuleFunc) EvalMutation ¶ added in v0.11.3
EvalMutation calls f(ctx, m).
type LinkQueryRuleFunc ¶ added in v0.11.3
The LinkQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type MixinIDMutationRuleFunc ¶
type MixinIDMutationRuleFunc func(context.Context, *ent.MixinIDMutation) error
The MixinIDMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (MixinIDMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type MixinIDQueryRuleFunc ¶
type MixinIDQueryRuleFunc func(context.Context, *ent.MixinIDQuery) error
The MixinIDQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type MutationPolicy ¶
type MutationPolicy = privacy.MutationPolicy
MutationPolicy combines multiple mutation rules into a single policy.
type MutationRule ¶
type MutationRule = privacy.MutationRule
MutationRule defines the interface which decides whether a mutation is allowed and optionally modifies it.
func DenyMutationOperationRule ¶
func DenyMutationOperationRule(op ent.Op) MutationRule
DenyMutationOperationRule returns a rule denying specified mutation operation.
func OnMutationOperation ¶
func OnMutationOperation(rule MutationRule, op ent.Op) MutationRule
OnMutationOperation evaluates the given rule only on a given mutation operation.
type MutationRuleFunc ¶
MutationRuleFunc type is an adapter which allows the use of ordinary functions as mutation rules.
func (MutationRuleFunc) EvalMutation ¶
EvalMutation returns f(ctx, m).
type NoteMutationRuleFunc ¶
type NoteMutationRuleFunc func(context.Context, *ent.NoteMutation) error
The NoteMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (NoteMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type NoteQueryRuleFunc ¶
The NoteQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type OtherMutationRuleFunc ¶
type OtherMutationRuleFunc func(context.Context, *ent.OtherMutation) error
The OtherMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OtherMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type OtherQueryRuleFunc ¶
type OtherQueryRuleFunc func(context.Context, *ent.OtherQuery) error
The OtherQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type PetMutationRuleFunc ¶
type PetMutationRuleFunc func(context.Context, *ent.PetMutation) error
The PetMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (PetMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type PetQueryRuleFunc ¶
The PetQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type QueryMutationRule ¶
type QueryMutationRule interface { QueryRule MutationRule }
QueryMutationRule is an interface which groups query and mutation rules.
func AlwaysAllowRule ¶
func AlwaysAllowRule() QueryMutationRule
AlwaysAllowRule returns a rule that returns an allow decision.
func AlwaysDenyRule ¶
func AlwaysDenyRule() QueryMutationRule
AlwaysDenyRule returns a rule that returns a deny decision.
func ContextQueryMutationRule ¶
func ContextQueryMutationRule(eval func(context.Context) error) QueryMutationRule
ContextQueryMutationRule creates a query/mutation rule from a context eval func.
type QueryPolicy ¶
type QueryPolicy = privacy.QueryPolicy
QueryPolicy combines multiple query rules into a single policy.
type QueryRule ¶
QueryRule defines the interface deciding whether a query is allowed and optionally modify it.
type QueryRuleFunc ¶
QueryRuleFunc type is an adapter to allow the use of ordinary functions as query rules.
type RevisionMutationRuleFunc ¶
type RevisionMutationRuleFunc func(context.Context, *ent.RevisionMutation) error
The RevisionMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (RevisionMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type RevisionQueryRuleFunc ¶
type RevisionQueryRuleFunc func(context.Context, *ent.RevisionQuery) error
The RevisionQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type SessionMutationRuleFunc ¶
type SessionMutationRuleFunc func(context.Context, *ent.SessionMutation) error
The SessionMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (SessionMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type SessionQueryRuleFunc ¶
type SessionQueryRuleFunc func(context.Context, *ent.SessionQuery) error
The SessionQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type TokenMutationRuleFunc ¶
type TokenMutationRuleFunc func(context.Context, *ent.TokenMutation) error
The TokenMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (TokenMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type TokenQueryRuleFunc ¶
type TokenQueryRuleFunc func(context.Context, *ent.TokenQuery) error
The TokenQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type UserMutationRuleFunc ¶
type UserMutationRuleFunc func(context.Context, *ent.UserMutation) error
The UserMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (UserMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type UserQueryRuleFunc ¶
The UserQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.