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 APIKeyMutationRuleFunc
- type APIKeyQueryRuleFunc
- type AgentMutationRuleFunc
- type AgentQueryRuleFunc
- type ApplicationMutationRuleFunc
- type ApplicationQueryRuleFunc
- type CredentialMutationRuleFunc
- type CredentialQueryRuleFunc
- type Filter
- type FilterFunc
- type HumanMutationRuleFunc
- type HumanQueryRuleFunc
- type InviteMutationRuleFunc
- type InviteQueryRuleFunc
- type MembershipMutationRuleFunc
- type MembershipQueryRuleFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type OAuthAccountMutationRuleFunc
- type OAuthAccountQueryRuleFunc
- type OAuthAppMutationRuleFunc
- type OAuthAppQueryRuleFunc
- type OAuthAppSecretMutationRuleFunc
- type OAuthAppSecretQueryRuleFunc
- type OAuthAuthCodeMutationRuleFunc
- type OAuthAuthCodeQueryRuleFunc
- type OAuthConsentMutationRuleFunc
- type OAuthConsentQueryRuleFunc
- type OAuthTokenMutationRuleFunc
- type OAuthTokenQueryRuleFunc
- type OrganizationMutationRuleFunc
- type OrganizationQueryRuleFunc
- type Policy
- type PrincipalMembershipMutationRuleFunc
- type PrincipalMembershipQueryRuleFunc
- type PrincipalMutationRuleFunc
- type PrincipalQueryRuleFunc
- type PrincipalTokenMutationRuleFunc
- type PrincipalTokenQueryRuleFunc
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
- type RefreshTokenMutationRuleFunc
- type RefreshTokenQueryRuleFunc
- type ServiceAccountKeyPairMutationRuleFunc
- type ServiceAccountKeyPairQueryRuleFunc
- type ServiceAccountMutationRuleFunc
- type ServiceAccountQueryRuleFunc
- type ServicePrincipalMutationRuleFunc
- type ServicePrincipalQueryRuleFunc
- 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 APIKeyMutationRuleFunc ¶
type APIKeyMutationRuleFunc func(context.Context, *ent.APIKeyMutation) error
The APIKeyMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (APIKeyMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type APIKeyQueryRuleFunc ¶
type APIKeyQueryRuleFunc func(context.Context, *ent.APIKeyQuery) error
The APIKeyQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type AgentMutationRuleFunc ¶ added in v0.2.0
type AgentMutationRuleFunc func(context.Context, *ent.AgentMutation) error
The AgentMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (AgentMutationRuleFunc) EvalMutation ¶ added in v0.2.0
EvalMutation calls f(ctx, m).
type AgentQueryRuleFunc ¶ added in v0.2.0
type AgentQueryRuleFunc func(context.Context, *ent.AgentQuery) error
The AgentQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type ApplicationMutationRuleFunc ¶ added in v0.2.0
type ApplicationMutationRuleFunc func(context.Context, *ent.ApplicationMutation) error
The ApplicationMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ApplicationMutationRuleFunc) EvalMutation ¶ added in v0.2.0
EvalMutation calls f(ctx, m).
type ApplicationQueryRuleFunc ¶ added in v0.2.0
type ApplicationQueryRuleFunc func(context.Context, *ent.ApplicationQuery) error
The ApplicationQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type CredentialMutationRuleFunc ¶ added in v0.2.0
type CredentialMutationRuleFunc func(context.Context, *ent.CredentialMutation) error
The CredentialMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (CredentialMutationRuleFunc) EvalMutation ¶ added in v0.2.0
EvalMutation calls f(ctx, m).
type CredentialQueryRuleFunc ¶ added in v0.2.0
type CredentialQueryRuleFunc func(context.Context, *ent.CredentialQuery) error
The CredentialQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type Filter ¶
Filter is the interface that wraps the Where function for filtering nodes in queries and mutations.
type FilterFunc ¶
The FilterFunc type is an adapter that allows the use of ordinary functions as filters for query and mutation types.
func (FilterFunc) EvalMutation ¶
EvalMutation calls f(ctx, q) if the mutation implements the Filter interface, otherwise it is denied.
type HumanMutationRuleFunc ¶ added in v0.2.0
type HumanMutationRuleFunc func(context.Context, *ent.HumanMutation) error
The HumanMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (HumanMutationRuleFunc) EvalMutation ¶ added in v0.2.0
EvalMutation calls f(ctx, m).
type HumanQueryRuleFunc ¶ added in v0.2.0
type HumanQueryRuleFunc func(context.Context, *ent.HumanQuery) error
The HumanQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type InviteMutationRuleFunc ¶ added in v0.2.0
type InviteMutationRuleFunc func(context.Context, *ent.InviteMutation) error
The InviteMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (InviteMutationRuleFunc) EvalMutation ¶ added in v0.2.0
EvalMutation calls f(ctx, m).
type InviteQueryRuleFunc ¶ added in v0.2.0
type InviteQueryRuleFunc func(context.Context, *ent.InviteQuery) error
The InviteQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type MembershipMutationRuleFunc ¶
type MembershipMutationRuleFunc func(context.Context, *ent.MembershipMutation) error
The MembershipMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (MembershipMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type MembershipQueryRuleFunc ¶
type MembershipQueryRuleFunc func(context.Context, *ent.MembershipQuery) error
The MembershipQueryRuleFunc 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 ¶
type MutationRuleFunc = privacy.MutationRuleFunc
MutationRuleFunc type is an adapter which allows the use of ordinary functions as mutation rules.
type OAuthAccountMutationRuleFunc ¶
type OAuthAccountMutationRuleFunc func(context.Context, *ent.OAuthAccountMutation) error
The OAuthAccountMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OAuthAccountMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type OAuthAccountQueryRuleFunc ¶
type OAuthAccountQueryRuleFunc func(context.Context, *ent.OAuthAccountQuery) error
The OAuthAccountQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type OAuthAppMutationRuleFunc ¶
type OAuthAppMutationRuleFunc func(context.Context, *ent.OAuthAppMutation) error
The OAuthAppMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OAuthAppMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type OAuthAppQueryRuleFunc ¶
type OAuthAppQueryRuleFunc func(context.Context, *ent.OAuthAppQuery) error
The OAuthAppQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type OAuthAppSecretMutationRuleFunc ¶
type OAuthAppSecretMutationRuleFunc func(context.Context, *ent.OAuthAppSecretMutation) error
The OAuthAppSecretMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OAuthAppSecretMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type OAuthAppSecretQueryRuleFunc ¶
type OAuthAppSecretQueryRuleFunc func(context.Context, *ent.OAuthAppSecretQuery) error
The OAuthAppSecretQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type OAuthAuthCodeMutationRuleFunc ¶
type OAuthAuthCodeMutationRuleFunc func(context.Context, *ent.OAuthAuthCodeMutation) error
The OAuthAuthCodeMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OAuthAuthCodeMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type OAuthAuthCodeQueryRuleFunc ¶
type OAuthAuthCodeQueryRuleFunc func(context.Context, *ent.OAuthAuthCodeQuery) error
The OAuthAuthCodeQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type OAuthConsentMutationRuleFunc ¶
type OAuthConsentMutationRuleFunc func(context.Context, *ent.OAuthConsentMutation) error
The OAuthConsentMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OAuthConsentMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type OAuthConsentQueryRuleFunc ¶
type OAuthConsentQueryRuleFunc func(context.Context, *ent.OAuthConsentQuery) error
The OAuthConsentQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type OAuthTokenMutationRuleFunc ¶
type OAuthTokenMutationRuleFunc func(context.Context, *ent.OAuthTokenMutation) error
The OAuthTokenMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OAuthTokenMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type OAuthTokenQueryRuleFunc ¶
type OAuthTokenQueryRuleFunc func(context.Context, *ent.OAuthTokenQuery) error
The OAuthTokenQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
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.
type PrincipalMembershipMutationRuleFunc ¶ added in v0.2.0
type PrincipalMembershipMutationRuleFunc func(context.Context, *ent.PrincipalMembershipMutation) error
The PrincipalMembershipMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (PrincipalMembershipMutationRuleFunc) EvalMutation ¶ added in v0.2.0
func (f PrincipalMembershipMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error
EvalMutation calls f(ctx, m).
type PrincipalMembershipQueryRuleFunc ¶ added in v0.2.0
type PrincipalMembershipQueryRuleFunc func(context.Context, *ent.PrincipalMembershipQuery) error
The PrincipalMembershipQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type PrincipalMutationRuleFunc ¶ added in v0.2.0
type PrincipalMutationRuleFunc func(context.Context, *ent.PrincipalMutation) error
The PrincipalMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (PrincipalMutationRuleFunc) EvalMutation ¶ added in v0.2.0
EvalMutation calls f(ctx, m).
type PrincipalQueryRuleFunc ¶ added in v0.2.0
type PrincipalQueryRuleFunc func(context.Context, *ent.PrincipalQuery) error
The PrincipalQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type PrincipalTokenMutationRuleFunc ¶ added in v0.2.0
type PrincipalTokenMutationRuleFunc func(context.Context, *ent.PrincipalTokenMutation) error
The PrincipalTokenMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (PrincipalTokenMutationRuleFunc) EvalMutation ¶ added in v0.2.0
EvalMutation calls f(ctx, m).
type PrincipalTokenQueryRuleFunc ¶ added in v0.2.0
type PrincipalTokenQueryRuleFunc func(context.Context, *ent.PrincipalTokenQuery) error
The PrincipalTokenQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
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 ¶
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 RefreshTokenMutationRuleFunc ¶
type RefreshTokenMutationRuleFunc func(context.Context, *ent.RefreshTokenMutation) error
The RefreshTokenMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (RefreshTokenMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type RefreshTokenQueryRuleFunc ¶
type RefreshTokenQueryRuleFunc func(context.Context, *ent.RefreshTokenQuery) error
The RefreshTokenQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type ServiceAccountKeyPairMutationRuleFunc ¶
type ServiceAccountKeyPairMutationRuleFunc func(context.Context, *ent.ServiceAccountKeyPairMutation) error
The ServiceAccountKeyPairMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ServiceAccountKeyPairMutationRuleFunc) EvalMutation ¶
func (f ServiceAccountKeyPairMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error
EvalMutation calls f(ctx, m).
type ServiceAccountKeyPairQueryRuleFunc ¶
type ServiceAccountKeyPairQueryRuleFunc func(context.Context, *ent.ServiceAccountKeyPairQuery) error
The ServiceAccountKeyPairQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type ServiceAccountMutationRuleFunc ¶
type ServiceAccountMutationRuleFunc func(context.Context, *ent.ServiceAccountMutation) error
The ServiceAccountMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ServiceAccountMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type ServiceAccountQueryRuleFunc ¶
type ServiceAccountQueryRuleFunc func(context.Context, *ent.ServiceAccountQuery) error
The ServiceAccountQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type ServicePrincipalMutationRuleFunc ¶ added in v0.2.0
type ServicePrincipalMutationRuleFunc func(context.Context, *ent.ServicePrincipalMutation) error
The ServicePrincipalMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ServicePrincipalMutationRuleFunc) EvalMutation ¶ added in v0.2.0
EvalMutation calls f(ctx, m).
type ServicePrincipalQueryRuleFunc ¶ added in v0.2.0
type ServicePrincipalQueryRuleFunc func(context.Context, *ent.ServicePrincipalQuery) error
The ServicePrincipalQueryRuleFunc 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.