privacy

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: GPL-3.0 Imports: 3 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 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 Allowf

func Allowf(format string, a ...any) error

Allowf returns a formatted wrapped Allow decision.

func DecisionContext

func DecisionContext(parent context.Context, decision error) context.Context

DecisionContext creates a new context from the given parent context with a policy decision attach to it.

func DecisionFromContext

func DecisionFromContext(ctx context.Context) (error, bool)

DecisionFromContext retrieves the policy decision from the context.

func Denyf

func Denyf(format string, a ...any) error

Denyf returns a formatted wrapped Deny decision.

func Skipf

func Skipf(format string, a ...any) error

Skipf returns a formatted wrapped Skip decision.

Types

type BeaconMutationRuleFunc

type BeaconMutationRuleFunc func(context.Context, *ent.BeaconMutation) error

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

func (BeaconMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type BeaconQueryRuleFunc

type BeaconQueryRuleFunc func(context.Context, *ent.BeaconQuery) error

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

func (BeaconQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type FileMutationRuleFunc

type FileMutationRuleFunc func(context.Context, *ent.FileMutation) error

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

func (FileMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type FileQueryRuleFunc

type FileQueryRuleFunc func(context.Context, *ent.FileQuery) error

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

func (FileQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type HostFileMutationRuleFunc added in v0.0.5

type HostFileMutationRuleFunc func(context.Context, *ent.HostFileMutation) error

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

func (HostFileMutationRuleFunc) EvalMutation added in v0.0.5

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

EvalMutation calls f(ctx, m).

type HostFileQueryRuleFunc added in v0.0.5

type HostFileQueryRuleFunc func(context.Context, *ent.HostFileQuery) error

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

func (HostFileQueryRuleFunc) EvalQuery added in v0.0.5

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

EvalQuery return f(ctx, q).

type HostMutationRuleFunc

type HostMutationRuleFunc func(context.Context, *ent.HostMutation) error

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

func (HostMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type HostProcessMutationRuleFunc added in v0.0.5

type HostProcessMutationRuleFunc func(context.Context, *ent.HostProcessMutation) error

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

func (HostProcessMutationRuleFunc) EvalMutation added in v0.0.5

EvalMutation calls f(ctx, m).

type HostProcessQueryRuleFunc added in v0.0.5

type HostProcessQueryRuleFunc func(context.Context, *ent.HostProcessQuery) error

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

func (HostProcessQueryRuleFunc) EvalQuery added in v0.0.5

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

EvalQuery return f(ctx, q).

type HostQueryRuleFunc

type HostQueryRuleFunc func(context.Context, *ent.HostQuery) error

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

func (HostQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

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

type MutationRuleFunc = privacy.MutationRuleFunc

MutationRuleFunc type is an adapter which allows the use of ordinary functions as mutation rules.

type Policy

type Policy = privacy.Policy

Policy groups query and mutation policies.

type QueryMutationRule

type QueryMutationRule = privacy.QueryMutationRule

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

type QueryRule = privacy.QueryRule

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 QuestMutationRuleFunc

type QuestMutationRuleFunc func(context.Context, *ent.QuestMutation) error

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

func (QuestMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type QuestQueryRuleFunc

type QuestQueryRuleFunc func(context.Context, *ent.QuestQuery) error

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

func (QuestQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

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

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

EvalMutation calls f(ctx, m).

type TagQueryRuleFunc

type TagQueryRuleFunc func(context.Context, *ent.TagQuery) error

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

func (TagQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type TaskMutationRuleFunc

type TaskMutationRuleFunc func(context.Context, *ent.TaskMutation) error

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

func (TaskMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type TaskQueryRuleFunc

type TaskQueryRuleFunc func(context.Context, *ent.TaskQuery) error

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

func (TaskQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type TomeMutationRuleFunc

type TomeMutationRuleFunc func(context.Context, *ent.TomeMutation) error

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

func (TomeMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type TomeQueryRuleFunc

type TomeQueryRuleFunc func(context.Context, *ent.TomeQuery) error

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

func (TomeQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

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

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

EvalMutation calls f(ctx, m).

type UserQueryRuleFunc

type UserQueryRuleFunc func(context.Context, *ent.UserQuery) error

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

func (UserQueryRuleFunc) EvalQuery

func (f UserQueryRuleFunc) 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