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 EntitlementMutationRuleFunc
- type EntitlementQueryRuleFunc
- type Filter
- type FilterFunc
- type GroupMutationRuleFunc
- type GroupQueryRuleFunc
- type GroupSettingsMutationRuleFunc
- type GroupSettingsQueryRuleFunc
- type IntegrationMutationRuleFunc
- type IntegrationQueryRuleFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type OauthProviderMutationRuleFunc
- type OauthProviderQueryRuleFunc
- type OrganizationMutationRuleFunc
- type OrganizationQueryRuleFunc
- type OrganizationSettingsMutationRuleFunc
- type OrganizationSettingsQueryRuleFunc
- type PersonalAccessTokenMutationRuleFunc
- type PersonalAccessTokenQueryRuleFunc
- type Policy
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
- type RefreshTokenMutationRuleFunc
- type RefreshTokenQueryRuleFunc
- type SessionMutationRuleFunc
- type SessionQueryRuleFunc
- type UserMutationRuleFunc
- type UserQueryRuleFunc
- type UserSettingsMutationRuleFunc
- type UserSettingsQueryRuleFunc
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 EntitlementMutationRuleFunc ¶
type EntitlementMutationRuleFunc func(context.Context, *generated.EntitlementMutation) error
The EntitlementMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (EntitlementMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type EntitlementQueryRuleFunc ¶
type EntitlementQueryRuleFunc func(context.Context, *generated.EntitlementQuery) error
The EntitlementQueryRuleFunc 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 GroupMutationRuleFunc ¶
type GroupMutationRuleFunc func(context.Context, *generated.GroupMutation) error
The GroupMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (GroupMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type GroupQueryRuleFunc ¶
type GroupQueryRuleFunc func(context.Context, *generated.GroupQuery) error
The GroupQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type GroupSettingsMutationRuleFunc ¶ added in v0.1.1
type GroupSettingsMutationRuleFunc func(context.Context, *generated.GroupSettingsMutation) error
The GroupSettingsMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (GroupSettingsMutationRuleFunc) EvalMutation ¶ added in v0.1.1
func (f GroupSettingsMutationRuleFunc) EvalMutation(ctx context.Context, m generated.Mutation) error
EvalMutation calls f(ctx, m).
type GroupSettingsQueryRuleFunc ¶ added in v0.1.1
type GroupSettingsQueryRuleFunc func(context.Context, *generated.GroupSettingsQuery) error
The GroupSettingsQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type IntegrationMutationRuleFunc ¶
type IntegrationMutationRuleFunc func(context.Context, *generated.IntegrationMutation) error
The IntegrationMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (IntegrationMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type IntegrationQueryRuleFunc ¶
type IntegrationQueryRuleFunc func(context.Context, *generated.IntegrationQuery) error
The IntegrationQueryRuleFunc 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 generated.Op) MutationRule
DenyMutationOperationRule returns a rule denying specified mutation operation.
func OnMutationOperation ¶
func OnMutationOperation(rule MutationRule, op generated.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 OauthProviderMutationRuleFunc ¶
type OauthProviderMutationRuleFunc func(context.Context, *generated.OauthProviderMutation) error
The OauthProviderMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OauthProviderMutationRuleFunc) EvalMutation ¶
func (f OauthProviderMutationRuleFunc) EvalMutation(ctx context.Context, m generated.Mutation) error
EvalMutation calls f(ctx, m).
type OauthProviderQueryRuleFunc ¶
type OauthProviderQueryRuleFunc func(context.Context, *generated.OauthProviderQuery) error
The OauthProviderQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type OrganizationMutationRuleFunc ¶
type OrganizationMutationRuleFunc func(context.Context, *generated.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, *generated.OrganizationQuery) error
The OrganizationQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type OrganizationSettingsMutationRuleFunc ¶ added in v0.1.1
type OrganizationSettingsMutationRuleFunc func(context.Context, *generated.OrganizationSettingsMutation) error
The OrganizationSettingsMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (OrganizationSettingsMutationRuleFunc) EvalMutation ¶ added in v0.1.1
func (f OrganizationSettingsMutationRuleFunc) EvalMutation(ctx context.Context, m generated.Mutation) error
EvalMutation calls f(ctx, m).
type OrganizationSettingsQueryRuleFunc ¶ added in v0.1.1
type OrganizationSettingsQueryRuleFunc func(context.Context, *generated.OrganizationSettingsQuery) error
The OrganizationSettingsQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type PersonalAccessTokenMutationRuleFunc ¶
type PersonalAccessTokenMutationRuleFunc func(context.Context, *generated.PersonalAccessTokenMutation) error
The PersonalAccessTokenMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (PersonalAccessTokenMutationRuleFunc) EvalMutation ¶
func (f PersonalAccessTokenMutationRuleFunc) EvalMutation(ctx context.Context, m generated.Mutation) error
EvalMutation calls f(ctx, m).
type PersonalAccessTokenQueryRuleFunc ¶
type PersonalAccessTokenQueryRuleFunc func(context.Context, *generated.PersonalAccessTokenQuery) error
The PersonalAccessTokenQueryRuleFunc 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 ¶ added in v0.1.1
type RefreshTokenMutationRuleFunc func(context.Context, *generated.RefreshTokenMutation) error
The RefreshTokenMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (RefreshTokenMutationRuleFunc) EvalMutation ¶ added in v0.1.1
EvalMutation calls f(ctx, m).
type RefreshTokenQueryRuleFunc ¶ added in v0.1.1
type RefreshTokenQueryRuleFunc func(context.Context, *generated.RefreshTokenQuery) error
The RefreshTokenQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type SessionMutationRuleFunc ¶
type SessionMutationRuleFunc func(context.Context, *generated.SessionMutation) error
The SessionMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (SessionMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type SessionQueryRuleFunc ¶
type SessionQueryRuleFunc func(context.Context, *generated.SessionQuery) error
The SessionQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type UserMutationRuleFunc ¶
type UserMutationRuleFunc func(context.Context, *generated.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.
type UserSettingsMutationRuleFunc ¶ added in v0.1.1
type UserSettingsMutationRuleFunc func(context.Context, *generated.UserSettingsMutation) error
The UserSettingsMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (UserSettingsMutationRuleFunc) EvalMutation ¶ added in v0.1.1
EvalMutation calls f(ctx, m).
type UserSettingsQueryRuleFunc ¶ added in v0.1.1
type UserSettingsQueryRuleFunc func(context.Context, *generated.UserSettingsQuery) error
The UserSettingsQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.