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 AddressMutationRuleFunc
- type AddressQueryRuleFunc
- type AuditLogMutationRuleFunc
- type AuditLogQueryRuleFunc
- type BusinessMutationRuleFunc
- type BusinessQueryRuleFunc
- type ContentMutationRuleFunc
- type ContentQueryRuleFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type OperatorMutationRuleFunc
- type OperatorQueryRuleFunc
- type Policy
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
- type TagMutationRuleFunc
- type TagQueryRuleFunc
- type TimetableMutationRuleFunc
- type TimetableQueryRuleFunc
- 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 AddressMutationRuleFunc ¶
type AddressMutationRuleFunc func(context.Context, *ent.AddressMutation) error
The AddressMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (AddressMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type AddressQueryRuleFunc ¶
type AddressQueryRuleFunc func(context.Context, *ent.AddressQuery) error
The AddressQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type AuditLogMutationRuleFunc ¶
type AuditLogMutationRuleFunc func(context.Context, *ent.AuditLogMutation) error
The AuditLogMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (AuditLogMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type AuditLogQueryRuleFunc ¶
type AuditLogQueryRuleFunc func(context.Context, *ent.AuditLogQuery) error
The AuditLogQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type BusinessMutationRuleFunc ¶
type BusinessMutationRuleFunc func(context.Context, *ent.BusinessMutation) error
The BusinessMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (BusinessMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type BusinessQueryRuleFunc ¶
type BusinessQueryRuleFunc func(context.Context, *ent.BusinessQuery) error
The BusinessQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type ContentMutationRuleFunc ¶
type ContentMutationRuleFunc func(context.Context, *ent.ContentMutation) error
The ContentMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ContentMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type ContentQueryRuleFunc ¶
type ContentQueryRuleFunc func(context.Context, *ent.ContentQuery) error
The ContentQueryRuleFunc 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 OperatorMutationRuleFunc ¶
type OperatorMutationRuleFunc func(context.Context, *ent.OperatorMutation) error
The OperatorMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OperatorMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type OperatorQueryRuleFunc ¶
type OperatorQueryRuleFunc func(context.Context, *ent.OperatorQuery) error
The OperatorQueryRuleFunc 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 TagMutationRuleFunc ¶
type TagMutationRuleFunc func(context.Context, *ent.TagMutation) error
The TagMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (TagMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type TagQueryRuleFunc ¶
The TagQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type TimetableMutationRuleFunc ¶
type TimetableMutationRuleFunc func(context.Context, *ent.TimetableMutation) error
The TimetableMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (TimetableMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type TimetableQueryRuleFunc ¶
type TimetableQueryRuleFunc func(context.Context, *ent.TimetableQuery) error
The TimetableQueryRuleFunc 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.