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 AdminLoginLogMutationRuleFunc
- type AdminLoginLogQueryRuleFunc
- type AdminMutationRuleFunc
- type AdminQueryRuleFunc
- type CasbinRuleMutationRuleFunc
- type CasbinRuleQueryRuleFunc
- type MemberLoginLogMutationRuleFunc
- type MemberLoginLogQueryRuleFunc
- type MemberMutationRuleFunc
- type MemberQueryRuleFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type NoteArticleMutationRuleFunc
- type NoteArticleQueryRuleFunc
- type NoteFilesystemMutationRuleFunc
- type NoteFilesystemQueryRuleFunc
- type OptionsMutationRuleFunc
- type OptionsQueryRuleFunc
- type Policy
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
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 AdminLoginLogMutationRuleFunc ¶
type AdminLoginLogMutationRuleFunc func(context.Context, *ent.AdminLoginLogMutation) error
The AdminLoginLogMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (AdminLoginLogMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type AdminLoginLogQueryRuleFunc ¶
type AdminLoginLogQueryRuleFunc func(context.Context, *ent.AdminLoginLogQuery) error
The AdminLoginLogQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type AdminMutationRuleFunc ¶
type AdminMutationRuleFunc func(context.Context, *ent.AdminMutation) error
The AdminMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (AdminMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type AdminQueryRuleFunc ¶
type AdminQueryRuleFunc func(context.Context, *ent.AdminQuery) error
The AdminQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type CasbinRuleMutationRuleFunc ¶
type CasbinRuleMutationRuleFunc func(context.Context, *ent.CasbinRuleMutation) error
The CasbinRuleMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (CasbinRuleMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type CasbinRuleQueryRuleFunc ¶
type CasbinRuleQueryRuleFunc func(context.Context, *ent.CasbinRuleQuery) error
The CasbinRuleQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type MemberLoginLogMutationRuleFunc ¶
type MemberLoginLogMutationRuleFunc func(context.Context, *ent.MemberLoginLogMutation) error
The MemberLoginLogMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (MemberLoginLogMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type MemberLoginLogQueryRuleFunc ¶
type MemberLoginLogQueryRuleFunc func(context.Context, *ent.MemberLoginLogQuery) error
The MemberLoginLogQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type MemberMutationRuleFunc ¶
type MemberMutationRuleFunc func(context.Context, *ent.MemberMutation) error
The MemberMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (MemberMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type MemberQueryRuleFunc ¶
type MemberQueryRuleFunc func(context.Context, *ent.MemberQuery) error
The MemberQueryRuleFunc 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 NoteArticleMutationRuleFunc ¶
type NoteArticleMutationRuleFunc func(context.Context, *ent.NoteArticleMutation) error
The NoteArticleMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (NoteArticleMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type NoteArticleQueryRuleFunc ¶
type NoteArticleQueryRuleFunc func(context.Context, *ent.NoteArticleQuery) error
The NoteArticleQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type NoteFilesystemMutationRuleFunc ¶
type NoteFilesystemMutationRuleFunc func(context.Context, *ent.NoteFilesystemMutation) error
The NoteFilesystemMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (NoteFilesystemMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type NoteFilesystemQueryRuleFunc ¶
type NoteFilesystemQueryRuleFunc func(context.Context, *ent.NoteFilesystemQuery) error
The NoteFilesystemQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type OptionsMutationRuleFunc ¶
type OptionsMutationRuleFunc func(context.Context, *ent.OptionsMutation) error
The OptionsMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OptionsMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type OptionsQueryRuleFunc ¶
type OptionsQueryRuleFunc func(context.Context, *ent.OptionsQuery) error
The OptionsQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
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 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.