privacy

package
v1.18.14 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: BSD-3-Clause 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 CampusMutationRuleFunc

type CampusMutationRuleFunc func(context.Context, *ent.CampusMutation) error

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

func (CampusMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type CampusQueryRuleFunc

type CampusQueryRuleFunc func(context.Context, *ent.CampusQuery) error

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

func (CampusQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type CarrierFacilityMutationRuleFunc

type CarrierFacilityMutationRuleFunc func(context.Context, *ent.CarrierFacilityMutation) error

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

func (CarrierFacilityMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type CarrierFacilityQueryRuleFunc

type CarrierFacilityQueryRuleFunc func(context.Context, *ent.CarrierFacilityQuery) error

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

func (CarrierFacilityQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type CarrierMutationRuleFunc

type CarrierMutationRuleFunc func(context.Context, *ent.CarrierMutation) error

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

func (CarrierMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type CarrierQueryRuleFunc

type CarrierQueryRuleFunc func(context.Context, *ent.CarrierQuery) error

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

func (CarrierQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type FacilityMutationRuleFunc

type FacilityMutationRuleFunc func(context.Context, *ent.FacilityMutation) error

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

func (FacilityMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type FacilityQueryRuleFunc

type FacilityQueryRuleFunc func(context.Context, *ent.FacilityQuery) error

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

func (FacilityQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type InternetExchangeMutationRuleFunc

type InternetExchangeMutationRuleFunc func(context.Context, *ent.InternetExchangeMutation) error

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

func (InternetExchangeMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type InternetExchangeQueryRuleFunc

type InternetExchangeQueryRuleFunc func(context.Context, *ent.InternetExchangeQuery) error

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

func (InternetExchangeQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type IxFacilityMutationRuleFunc

type IxFacilityMutationRuleFunc func(context.Context, *ent.IxFacilityMutation) error

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

func (IxFacilityMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type IxFacilityQueryRuleFunc

type IxFacilityQueryRuleFunc func(context.Context, *ent.IxFacilityQuery) error

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

func (IxFacilityQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type IxLanMutationRuleFunc

type IxLanMutationRuleFunc func(context.Context, *ent.IxLanMutation) error

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

func (IxLanMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type IxLanQueryRuleFunc

type IxLanQueryRuleFunc func(context.Context, *ent.IxLanQuery) error

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

func (IxLanQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type IxPrefixMutationRuleFunc

type IxPrefixMutationRuleFunc func(context.Context, *ent.IxPrefixMutation) error

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

func (IxPrefixMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type IxPrefixQueryRuleFunc

type IxPrefixQueryRuleFunc func(context.Context, *ent.IxPrefixQuery) error

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

func (IxPrefixQueryRuleFunc) EvalQuery

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

type NetworkFacilityMutationRuleFunc func(context.Context, *ent.NetworkFacilityMutation) error

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

func (NetworkFacilityMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type NetworkFacilityQueryRuleFunc

type NetworkFacilityQueryRuleFunc func(context.Context, *ent.NetworkFacilityQuery) error

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

func (NetworkFacilityQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type NetworkIxLanMutationRuleFunc

type NetworkIxLanMutationRuleFunc func(context.Context, *ent.NetworkIxLanMutation) error

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

func (NetworkIxLanMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type NetworkIxLanQueryRuleFunc

type NetworkIxLanQueryRuleFunc func(context.Context, *ent.NetworkIxLanQuery) error

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

func (NetworkIxLanQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type NetworkMutationRuleFunc

type NetworkMutationRuleFunc func(context.Context, *ent.NetworkMutation) error

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

func (NetworkMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type NetworkQueryRuleFunc

type NetworkQueryRuleFunc func(context.Context, *ent.NetworkQuery) error

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

func (NetworkQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type OrganizationMutationRuleFunc

type OrganizationMutationRuleFunc func(context.Context, *ent.OrganizationMutation) error

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

func (OrganizationMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type OrganizationQueryRuleFunc

type OrganizationQueryRuleFunc func(context.Context, *ent.OrganizationQuery) error

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

func (OrganizationQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type PocMutationRuleFunc

type PocMutationRuleFunc func(context.Context, *ent.PocMutation) error

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

func (PocMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type PocQueryRuleFunc

type PocQueryRuleFunc func(context.Context, *ent.PocQuery) error

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

func (PocQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

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).

Jump to

Keyboard shortcuts

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