Documentation
¶
Index ¶
- Variables
- func Allowf(format string, a ...interface{}) error
- func DecisionContext(parent context.Context, decision error) context.Context
- func Denyf(format string, a ...interface{}) error
- func Skipf(format string, a ...interface{}) error
- type DialogMutationRuleFunc
- type DialogQueryRuleFunc
- type MessageMutationRuleFunc
- type MessageQueryRuleFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type Policy
- type ProjectMutationRuleFunc
- type ProjectQueryRuleFunc
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
- 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 an allow decision. Allow = errors.New("ent/privacy: allow rule") // Deny may be returned by rules to indicate that the policy // evaluation should terminate with an deny decision. Deny = errors.New("ent/privacy: deny rule") // Skip may be returned by rules to indicate that the policy // evaluation should continue to the next rule. Skip = errors.New("ent/privacy: skip rule") )
Functions ¶
func DecisionContext ¶
DecisionContext creates a decision context.
Types ¶
type DialogMutationRuleFunc ¶
type DialogMutationRuleFunc func(context.Context, *ent.DialogMutation) error
The DialogMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (DialogMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type DialogQueryRuleFunc ¶
type DialogQueryRuleFunc func(context.Context, *ent.DialogQuery) error
The DialogQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type MessageMutationRuleFunc ¶
type MessageMutationRuleFunc func(context.Context, *ent.MessageMutation) error
The MessageMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (MessageMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type MessageQueryRuleFunc ¶
type MessageQueryRuleFunc func(context.Context, *ent.MessageQuery) error
The MessageQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type MutationPolicy ¶
type MutationPolicy []MutationRule
MutationPolicy combines multiple mutation rules into a single policy.
func (MutationPolicy) EvalMutation ¶
EvalMutation evaluates a mutation against a mutation policy.
type MutationRule ¶
MutationRule defines the interface deciding whether a mutation is allowed and optionally modify 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 to allow the use of ordinary functions as mutation rules.
func (MutationRuleFunc) EvalMutation ¶
EvalMutation returns f(ctx, m).
type Policy ¶
type Policy struct { Query QueryPolicy Mutation MutationPolicy }
Policy groups query and mutation policies.
func (Policy) EvalMutation ¶
EvalMutation forwards evaluation to mutation policy.
type ProjectMutationRuleFunc ¶
type ProjectMutationRuleFunc func(context.Context, *ent.ProjectMutation) error
The ProjectMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ProjectMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type ProjectQueryRuleFunc ¶
type ProjectQueryRuleFunc func(context.Context, *ent.ProjectQuery) error
The ProjectQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type QueryMutationRule ¶
type QueryMutationRule interface { QueryRule MutationRule }
QueryMutationRule is the interface that 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 []QueryRule
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 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.