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 AttachedFileMutationRuleFunc
- type AttachedFileQueryRuleFunc
- type FileMutationRuleFunc
- type FileQueryRuleFunc
- type Filter
- type FilterFunc
- type FriendshipMutationRuleFunc
- type FriendshipQueryRuleFunc
- type GroupMutationRuleFunc
- type GroupQueryRuleFunc
- type GroupTagMutationRuleFunc
- type GroupTagQueryRuleFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type Policy
- type ProcessMutationRuleFunc
- type ProcessQueryRuleFunc
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
- type RelationshipInfoMutationRuleFunc
- type RelationshipInfoQueryRuleFunc
- type RelationshipMutationRuleFunc
- type RelationshipQueryRuleFunc
- type RoleMutationRuleFunc
- type RoleQueryRuleFunc
- type RoleUserMutationRuleFunc
- type RoleUserQueryRuleFunc
- type TagMutationRuleFunc
- type TagQueryRuleFunc
- type TweetLikeMutationRuleFunc
- type TweetLikeQueryRuleFunc
- type TweetMutationRuleFunc
- type TweetQueryRuleFunc
- type TweetTagMutationRuleFunc
- type TweetTagQueryRuleFunc
- type UserGroupMutationRuleFunc
- type UserGroupQueryRuleFunc
- type UserMutationRuleFunc
- type UserQueryRuleFunc
- type UserTweetMutationRuleFunc
- type UserTweetQueryRuleFunc
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 AttachedFileMutationRuleFunc ¶ added in v0.11.8
type AttachedFileMutationRuleFunc func(context.Context, *ent.AttachedFileMutation) error
The AttachedFileMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (AttachedFileMutationRuleFunc) EvalMutation ¶ added in v0.11.8
EvalMutation calls f(ctx, m).
type AttachedFileQueryRuleFunc ¶ added in v0.11.8
type AttachedFileQueryRuleFunc func(context.Context, *ent.AttachedFileQuery) error
The AttachedFileQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type FileMutationRuleFunc ¶ added in v0.11.8
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 ¶ added in v0.11.8
EvalMutation calls f(ctx, m).
type FileQueryRuleFunc ¶ added in v0.11.8
The FileQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type Filter ¶ added in v0.11.2
Filter is the interface that wraps the Where function for filtering nodes in queries and mutations.
type FilterFunc ¶ added in v0.11.2
The FilterFunc type is an adapter that allows the use of ordinary functions as filters for query and mutation types.
func (FilterFunc) EvalMutation ¶ added in v0.11.2
EvalMutation calls f(ctx, q) if the mutation implements the Filter interface, otherwise it is denied.
type FriendshipMutationRuleFunc ¶
type FriendshipMutationRuleFunc func(context.Context, *ent.FriendshipMutation) error
The FriendshipMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (FriendshipMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type FriendshipQueryRuleFunc ¶
type FriendshipQueryRuleFunc func(context.Context, *ent.FriendshipQuery) error
The FriendshipQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type GroupMutationRuleFunc ¶
type GroupMutationRuleFunc func(context.Context, *ent.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, *ent.GroupQuery) error
The GroupQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type GroupTagMutationRuleFunc ¶ added in v0.11.5
type GroupTagMutationRuleFunc func(context.Context, *ent.GroupTagMutation) error
The GroupTagMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (GroupTagMutationRuleFunc) EvalMutation ¶ added in v0.11.5
EvalMutation calls f(ctx, m).
type GroupTagQueryRuleFunc ¶ added in v0.11.5
type GroupTagQueryRuleFunc func(context.Context, *ent.GroupTagQuery) error
The GroupTagQueryRuleFunc 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 ¶
MutationRuleFunc type is an adapter which allows the use of ordinary functions as mutation rules.
func (MutationRuleFunc) EvalMutation ¶
EvalMutation returns f(ctx, m).
type ProcessMutationRuleFunc ¶ added in v0.11.8
type ProcessMutationRuleFunc func(context.Context, *ent.ProcessMutation) error
The ProcessMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ProcessMutationRuleFunc) EvalMutation ¶ added in v0.11.8
EvalMutation calls f(ctx, m).
type ProcessQueryRuleFunc ¶ added in v0.11.8
type ProcessQueryRuleFunc func(context.Context, *ent.ProcessQuery) error
The ProcessQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
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 ¶
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 RelationshipInfoMutationRuleFunc ¶
type RelationshipInfoMutationRuleFunc func(context.Context, *ent.RelationshipInfoMutation) error
The RelationshipInfoMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (RelationshipInfoMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type RelationshipInfoQueryRuleFunc ¶
type RelationshipInfoQueryRuleFunc func(context.Context, *ent.RelationshipInfoQuery) error
The RelationshipInfoQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type RelationshipMutationRuleFunc ¶
type RelationshipMutationRuleFunc func(context.Context, *ent.RelationshipMutation) error
The RelationshipMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (RelationshipMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type RelationshipQueryRuleFunc ¶
type RelationshipQueryRuleFunc func(context.Context, *ent.RelationshipQuery) error
The RelationshipQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type RoleMutationRuleFunc ¶ added in v0.11.1
type RoleMutationRuleFunc func(context.Context, *ent.RoleMutation) error
The RoleMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (RoleMutationRuleFunc) EvalMutation ¶ added in v0.11.1
EvalMutation calls f(ctx, m).
type RoleQueryRuleFunc ¶ added in v0.11.1
The RoleQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type RoleUserMutationRuleFunc ¶ added in v0.11.1
type RoleUserMutationRuleFunc func(context.Context, *ent.RoleUserMutation) error
The RoleUserMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (RoleUserMutationRuleFunc) EvalMutation ¶ added in v0.11.1
EvalMutation calls f(ctx, m).
type RoleUserQueryRuleFunc ¶ added in v0.11.1
type RoleUserQueryRuleFunc func(context.Context, *ent.RoleUserQuery) error
The RoleUserQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
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 ¶
EvalMutation calls f(ctx, m).
type TagQueryRuleFunc ¶
The TagQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type TweetLikeMutationRuleFunc ¶
type TweetLikeMutationRuleFunc func(context.Context, *ent.TweetLikeMutation) error
The TweetLikeMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (TweetLikeMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type TweetLikeQueryRuleFunc ¶
type TweetLikeQueryRuleFunc func(context.Context, *ent.TweetLikeQuery) error
The TweetLikeQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type TweetMutationRuleFunc ¶
type TweetMutationRuleFunc func(context.Context, *ent.TweetMutation) error
The TweetMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (TweetMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type TweetQueryRuleFunc ¶
type TweetQueryRuleFunc func(context.Context, *ent.TweetQuery) error
The TweetQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type TweetTagMutationRuleFunc ¶
type TweetTagMutationRuleFunc func(context.Context, *ent.TweetTagMutation) error
The TweetTagMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (TweetTagMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type TweetTagQueryRuleFunc ¶
type TweetTagQueryRuleFunc func(context.Context, *ent.TweetTagQuery) error
The TweetTagQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type UserGroupMutationRuleFunc ¶
type UserGroupMutationRuleFunc func(context.Context, *ent.UserGroupMutation) error
The UserGroupMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (UserGroupMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type UserGroupQueryRuleFunc ¶
type UserGroupQueryRuleFunc func(context.Context, *ent.UserGroupQuery) error
The UserGroupQueryRuleFunc 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.
type UserTweetMutationRuleFunc ¶
type UserTweetMutationRuleFunc func(context.Context, *ent.UserTweetMutation) error
The UserTweetMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (UserTweetMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type UserTweetQueryRuleFunc ¶
type UserTweetQueryRuleFunc func(context.Context, *ent.UserTweetQuery) error
The UserTweetQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.