privacy

package
v0.0.0-...-444ad2e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 Allowf

func Allowf(format string, a ...interface{}) error

Allowf returns an formatted wrapped Allow decision.

func Denyf

func Denyf(format string, a ...interface{}) error

Denyf returns an formatted wrapped Deny decision.

func Skipf

func Skipf(format string, a ...interface{}) error

Skipf returns an formatted wrapped Skip decision.

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

func (f AccountMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

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.

func (AccountQueryRuleFunc) EvalQuery

func (f AccountQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type AnswerMutationRuleFunc

type AnswerMutationRuleFunc func(context.Context, *ent.AnswerMutation) error

The AnswerMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (AnswerMutationRuleFunc) EvalMutation

func (f AnswerMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type AnswerQueryRuleFunc

type AnswerQueryRuleFunc func(context.Context, *ent.AnswerQuery) error

The AnswerQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (AnswerQueryRuleFunc) EvalQuery

func (f AnswerQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type ContactMutationRuleFunc

type ContactMutationRuleFunc func(context.Context, *ent.ContactMutation) error

The ContactMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (ContactMutationRuleFunc) EvalMutation

func (f ContactMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type ContactQueryRuleFunc

type ContactQueryRuleFunc func(context.Context, *ent.ContactQuery) error

The ContactQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (ContactQueryRuleFunc) EvalQuery

func (f ContactQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

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

func (f DeviceMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

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.

func (DeviceQueryRuleFunc) EvalQuery

func (f DeviceQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type DomainMutationRuleFunc

type DomainMutationRuleFunc func(context.Context, *ent.DomainMutation) error

The DomainMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (DomainMutationRuleFunc) EvalMutation

func (f DomainMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type DomainQueryRuleFunc

type DomainQueryRuleFunc func(context.Context, *ent.DomainQuery) error

The DomainQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (DomainQueryRuleFunc) EvalQuery

func (f DomainQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type FlowMutationRuleFunc

type FlowMutationRuleFunc func(context.Context, *ent.FlowMutation) error

The FlowMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (FlowMutationRuleFunc) EvalMutation

func (f FlowMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type FlowQueryRuleFunc

type FlowQueryRuleFunc func(context.Context, *ent.FlowQuery) error

The FlowQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (FlowQueryRuleFunc) EvalQuery

func (f FlowQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type IPMutationRuleFunc

type IPMutationRuleFunc func(context.Context, *ent.IPMutation) error

The IPMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (IPMutationRuleFunc) EvalMutation

func (f IPMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type IPQueryRuleFunc

type IPQueryRuleFunc func(context.Context, *ent.IPQuery) error

The IPQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (IPQueryRuleFunc) EvalQuery

func (f IPQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type InputMutationRuleFunc

type InputMutationRuleFunc func(context.Context, *ent.InputMutation) error

The InputMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (InputMutationRuleFunc) EvalMutation

func (f InputMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type InputQueryRuleFunc

type InputQueryRuleFunc func(context.Context, *ent.InputQuery) error

The InputQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (InputQueryRuleFunc) EvalQuery

func (f InputQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type MutationPolicy

type MutationPolicy []MutationRule

MutationPolicy combines multiple mutation rules into a single policy.

func (MutationPolicy) EvalMutation

func (policy MutationPolicy) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation evaluates a mutation against a mutation policy.

type MutationRule

type MutationRule interface {
	EvalMutation(context.Context, ent.Mutation) error
}

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.

type MutationRuleFunc

type MutationRuleFunc func(context.Context, ent.Mutation) error

MutationRuleFunc type is an adapter to allow the use of ordinary functions as mutation rules.

func (MutationRuleFunc) EvalMutation

func (f MutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation returns f(ctx, m).

type PersonMutationRuleFunc

type PersonMutationRuleFunc func(context.Context, *ent.PersonMutation) error

The PersonMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (PersonMutationRuleFunc) EvalMutation

func (f PersonMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type PersonQueryRuleFunc

type PersonQueryRuleFunc func(context.Context, *ent.PersonQuery) error

The PersonQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (PersonQueryRuleFunc) EvalQuery

func (f PersonQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type Policy

type Policy struct {
	Query    QueryPolicy
	Mutation MutationPolicy
}

Policy groups query and mutation policies.

func (Policy) EvalMutation

func (policy Policy) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation forwards evaluation to mutation policy.

func (Policy) EvalQuery

func (policy Policy) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery forwards evaluation to query 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.

type QueryPolicy

type QueryPolicy []QueryRule

QueryPolicy combines multiple query rules into a single policy.

func (QueryPolicy) EvalQuery

func (policy QueryPolicy) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery evaluates a query against a query policy.

type QueryRule

type QueryRule interface {
	EvalQuery(context.Context, ent.Query) error
}

QueryRule defines the interface deciding whether a query is allowed and optionally modify it.

type QueryRuleFunc

type QueryRuleFunc func(context.Context, ent.Query) error

QueryRuleFunc type is an adapter to allow the use of ordinary functions as query rules.

func (QueryRuleFunc) EvalQuery

func (f QueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

Eval returns f(ctx, q).

type QuestionMutationRuleFunc

type QuestionMutationRuleFunc func(context.Context, *ent.QuestionMutation) error

The QuestionMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (QuestionMutationRuleFunc) EvalMutation

func (f QuestionMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type QuestionQueryRuleFunc

type QuestionQueryRuleFunc func(context.Context, *ent.QuestionQuery) error

The QuestionQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (QuestionQueryRuleFunc) EvalQuery

func (f QuestionQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type ShortMutationRuleFunc

type ShortMutationRuleFunc func(context.Context, *ent.ShortMutation) error

The ShortMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (ShortMutationRuleFunc) EvalMutation

func (f ShortMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type ShortQueryRuleFunc

type ShortQueryRuleFunc func(context.Context, *ent.ShortQuery) error

The ShortQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (ShortQueryRuleFunc) EvalQuery

func (f ShortQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

type SurveyMutationRuleFunc

type SurveyMutationRuleFunc func(context.Context, *ent.SurveyMutation) error

The SurveyMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.

func (SurveyMutationRuleFunc) EvalMutation

func (f SurveyMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error

EvalMutation calls f(ctx, m).

type SurveyQueryRuleFunc

type SurveyQueryRuleFunc func(context.Context, *ent.SurveyQuery) error

The SurveyQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.

func (SurveyQueryRuleFunc) EvalQuery

func (f SurveyQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error

EvalQuery return f(ctx, q).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL