privacy

package
v0.0.0-...-5435fe0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 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 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 ...interface{}) error

Allowf returns an 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 ...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 DiscordAccountMutationRuleFunc

type DiscordAccountMutationRuleFunc func(context.Context, *ent.DiscordAccountMutation) error

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

func (DiscordAccountMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type DiscordAccountQueryRuleFunc

type DiscordAccountQueryRuleFunc func(context.Context, *ent.DiscordAccountQuery) error

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

func (DiscordAccountQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type DiscordBotMutationRuleFunc

type DiscordBotMutationRuleFunc func(context.Context, *ent.DiscordBotMutation) error

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

func (DiscordBotMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type DiscordBotQueryRuleFunc

type DiscordBotQueryRuleFunc func(context.Context, *ent.DiscordBotQuery) error

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

func (DiscordBotQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type GithubAccountMutationRuleFunc

type GithubAccountMutationRuleFunc func(context.Context, *ent.GithubAccountMutation) error

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

func (GithubAccountMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type GithubAccountQueryRuleFunc

type GithubAccountQueryRuleFunc func(context.Context, *ent.GithubAccountQuery) error

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

func (GithubAccountQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type GithubOrganizationMemberMutationRuleFunc

type GithubOrganizationMemberMutationRuleFunc func(context.Context, *ent.GithubOrganizationMemberMutation) error

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

func (GithubOrganizationMemberMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type GithubOrganizationMemberQueryRuleFunc

type GithubOrganizationMemberQueryRuleFunc func(context.Context, *ent.GithubOrganizationMemberQuery) error

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

func (GithubOrganizationMemberQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type GithubOrganizationMutationRuleFunc

type GithubOrganizationMutationRuleFunc func(context.Context, *ent.GithubOrganizationMutation) error

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

func (GithubOrganizationMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type GithubOrganizationQueryRuleFunc

type GithubOrganizationQueryRuleFunc func(context.Context, *ent.GithubOrganizationQuery) error

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

func (GithubOrganizationQueryRuleFunc) EvalQuery

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 func(context.Context, ent.Mutation) error

MutationRuleFunc type is an adapter which allows 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 Policy

type Policy = privacy.Policy

Policy groups query and mutation policies.

type ProjectAssociationMutationRuleFunc

type ProjectAssociationMutationRuleFunc func(context.Context, *ent.ProjectAssociationMutation) error

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

func (ProjectAssociationMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type ProjectAssociationQueryRuleFunc

type ProjectAssociationQueryRuleFunc func(context.Context, *ent.ProjectAssociationQuery) error

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

func (ProjectAssociationQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type ProjectContributorMutationRuleFunc

type ProjectContributorMutationRuleFunc func(context.Context, *ent.ProjectContributorMutation) error

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

func (ProjectContributorMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type ProjectContributorQueryRuleFunc

type ProjectContributorQueryRuleFunc func(context.Context, *ent.ProjectContributorQuery) error

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

func (ProjectContributorQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type ProjectMutationRuleFunc

type ProjectMutationRuleFunc func(context.Context, *ent.ProjectMutation) error

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

func (ProjectMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type ProjectQueryRuleFunc

type ProjectQueryRuleFunc func(context.Context, *ent.ProjectQuery) error

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

func (ProjectQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type ProjectTechnologyMutationRuleFunc

type ProjectTechnologyMutationRuleFunc func(context.Context, *ent.ProjectTechnologyMutation) error

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

func (ProjectTechnologyMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type ProjectTechnologyQueryRuleFunc

type ProjectTechnologyQueryRuleFunc func(context.Context, *ent.ProjectTechnologyQuery) error

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

func (ProjectTechnologyQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

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

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 RepositoryMutationRuleFunc

type RepositoryMutationRuleFunc func(context.Context, *ent.RepositoryMutation) error

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

func (RepositoryMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type RepositoryQueryRuleFunc

type RepositoryQueryRuleFunc func(context.Context, *ent.RepositoryQuery) error

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

func (RepositoryQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type RepositoryTechnologyMutationRuleFunc

type RepositoryTechnologyMutationRuleFunc func(context.Context, *ent.RepositoryTechnologyMutation) error

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

func (RepositoryTechnologyMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type RepositoryTechnologyQueryRuleFunc

type RepositoryTechnologyQueryRuleFunc func(context.Context, *ent.RepositoryTechnologyQuery) error

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

func (RepositoryTechnologyQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type SiteMutationRuleFunc

type SiteMutationRuleFunc func(context.Context, *ent.SiteMutation) error

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

func (SiteMutationRuleFunc) EvalMutation

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

EvalMutation calls f(ctx, m).

type SiteQueryRuleFunc

type SiteQueryRuleFunc func(context.Context, *ent.SiteQuery) error

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

func (SiteQueryRuleFunc) EvalQuery

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

EvalQuery return f(ctx, q).

type TechnologyAssociationMutationRuleFunc

type TechnologyAssociationMutationRuleFunc func(context.Context, *ent.TechnologyAssociationMutation) error

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

func (TechnologyAssociationMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type TechnologyAssociationQueryRuleFunc

type TechnologyAssociationQueryRuleFunc func(context.Context, *ent.TechnologyAssociationQuery) error

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

func (TechnologyAssociationQueryRuleFunc) EvalQuery

EvalQuery return f(ctx, q).

type TechnologyMutationRuleFunc

type TechnologyMutationRuleFunc func(context.Context, *ent.TechnologyMutation) error

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

func (TechnologyMutationRuleFunc) EvalMutation

EvalMutation calls f(ctx, m).

type TechnologyQueryRuleFunc

type TechnologyQueryRuleFunc func(context.Context, *ent.TechnologyQuery) error

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

func (TechnologyQueryRuleFunc) EvalQuery

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