Documentation ¶
Index ¶
- func Rules(rules ...ent.PrivacyPolicyRule) []ent.PrivacyPolicyRule
- type AllowIfClosureRule
- type AllowIfEdgeExistsRule
- type AllowIfOmniscientRule
- type AllowIfValidMutationBuilderRule
- type AllowIfViewerInboundEdgeExistsRule
- type AllowIfViewerIsOwnerRule
- type AllowIfViewerOutboundEdgeExistsRule
- type AllowIfViewerRule
- type AlwaysAllowPrivacyPolicy
- type AlwaysAllowRule
- type AlwaysDenyPrivacyPolicy
- type AlwaysDenyRule
- type AlwaysPanicPrivacyPolicy
- type DenyIfEdgeExistsRule
- type DenyIfLoggedOutRule
- type DenyIfViewerInboundEdgeExistsRule
- type DenyIfViewerOutboundEdgeExistsRule
- type InlinePrivacyPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Rules ¶
func Rules(rules ...ent.PrivacyPolicyRule) []ent.PrivacyPolicyRule
Rules is a helper method for passing in a list of Privacy Rules to InlinePrivacyPolicy and other places which take in a list of rules
Types ¶
type AllowIfClosureRule ¶
type AllowIfClosureRule struct {
Func func(v viewer.ViewerContext, ent ent.Entity) bool
}
func (AllowIfClosureRule) Eval ¶
func (rule AllowIfClosureRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
type AllowIfEdgeExistsRule ¶
AllowIfEdgeExistsRule is a privacy rule that passes if an edge exists between the given IDs
func (AllowIfEdgeExistsRule) Eval ¶
func (rule AllowIfEdgeExistsRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval evaluates the AllowIfEdgeExistsRule privacy rule
type AllowIfOmniscientRule ¶
type AllowIfOmniscientRule struct{}
AllowIfOmniscientRule is a reusable rule that comes with the ent framework that says an ent is visible to the viewer if the viewer is omniscient (or has admin privileges)
func (AllowIfOmniscientRule) Eval ¶
func (rule AllowIfOmniscientRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval is the method called to evaluate the visibility of the ent and always returns AllowResult if viewer is omniscient. Otherwise, returns SkipResult
type AllowIfValidMutationBuilderRule ¶
type AllowIfValidMutationBuilderRule struct {
Builder ent.MutationBuilder
}
func (AllowIfValidMutationBuilderRule) Eval ¶
func (rule AllowIfValidMutationBuilderRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
type AllowIfViewerInboundEdgeExistsRule ¶
AllowIfViewerInboundEdgeExistsRule is a privacy rule that passes if an edge exists between the viewer and the ent
func (AllowIfViewerInboundEdgeExistsRule) Eval ¶
func (rule AllowIfViewerInboundEdgeExistsRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval evaluates the AllowIfViewerInboundEdgeExistsRule privacy rule
type AllowIfViewerIsOwnerRule ¶
type AllowIfViewerIsOwnerRule struct {
OwnerID string
}
AllowIfViewerIsOwnerRule is a reusable rule that says the underlying ent is only visible if the viewer ID is equal to the passed OwnerID
func (AllowIfViewerIsOwnerRule) Eval ¶
func (rule AllowIfViewerIsOwnerRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval is the method called to evaluate the visibility of the ent and always returns DenyResult if viewer is logged out. Otherwise, returns SkipResult
type AllowIfViewerOutboundEdgeExistsRule ¶
AllowIfViewerOutboundEdgeExistsRule is a privacy rule that passes if an edge exists between the viewer and the ent
func (AllowIfViewerOutboundEdgeExistsRule) Eval ¶
func (rule AllowIfViewerOutboundEdgeExistsRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval evaluates the AllowIfViewerOutboundEdgeExistsRule privacy rule
type AllowIfViewerRule ¶
type AllowIfViewerRule struct {
EntID string
}
AllowIfViewerRule is a reusable rule that says the underlying ent is only visible if the viewer ID is equal to the passed EntID
func (AllowIfViewerRule) Eval ¶
func (rule AllowIfViewerRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval is the method called to evaluate the visibility of the ent and always returns DenyResult if viewer is logged out. Otherwise, returns SkipResult
type AlwaysAllowPrivacyPolicy ¶
func (AlwaysAllowPrivacyPolicy) GetPrivacyPolicy ¶
func (p AlwaysAllowPrivacyPolicy) GetPrivacyPolicy() ent.PrivacyPolicy
type AlwaysAllowRule ¶
type AlwaysAllowRule struct{}
AlwaysAllowRule is a reusable rule that comes with the ent framework that says an ent is always visible to the viewer
func (AlwaysAllowRule) Eval ¶
func (rule AlwaysAllowRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval is the method called to evaluate the visibility of the ent and always returns AllowResult
type AlwaysDenyPrivacyPolicy ¶
func (AlwaysDenyPrivacyPolicy) GetPrivacyPolicy ¶
func (p AlwaysDenyPrivacyPolicy) GetPrivacyPolicy() ent.PrivacyPolicy
type AlwaysDenyRule ¶
type AlwaysDenyRule struct{}
AlwaysDenyRule is a reusable rule that comes with the ent framework that says an ent is always invisible to the viewer
func (AlwaysDenyRule) Eval ¶
func (rule AlwaysDenyRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval is the method called to evaluate the visibility of the ent and always returns DenyResult
type AlwaysPanicPrivacyPolicy ¶
func (AlwaysPanicPrivacyPolicy) GetPrivacyPolicy ¶
func (p AlwaysPanicPrivacyPolicy) GetPrivacyPolicy() ent.PrivacyPolicy
type DenyIfEdgeExistsRule ¶
DenyIfEdgeExistsRule is a privacy rule that passes if an edge exists between the given IDs
func (DenyIfEdgeExistsRule) Eval ¶
func (rule DenyIfEdgeExistsRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval evaluates the AllowIfEdgeExistsRule privacy rule
type DenyIfLoggedOutRule ¶
type DenyIfLoggedOutRule struct{}
DenyIfLoggedOutRule is a reusable rule that comes with the ent framework that says an ent is not visible to any logged out users
func (DenyIfLoggedOutRule) Eval ¶
func (rule DenyIfLoggedOutRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval is the method called to evaluate the visibility of the ent and always returns DenyResult if viewer is logged out. Otherwise, returns SkipResult
type DenyIfViewerInboundEdgeExistsRule ¶
type DenyIfViewerInboundEdgeExistsRule struct { Policy ent.PrivacyPolicy EdgeType ent.EdgeType }
DenyIfViewerInboundEdgeExistsRule is a privacy rule that passes if an edge exists between the viewer and the ent
func (DenyIfViewerInboundEdgeExistsRule) Eval ¶
func (rule DenyIfViewerInboundEdgeExistsRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval evaluates the DenyIfViewerInboundEdgeExistsRule privacy rule
type DenyIfViewerOutboundEdgeExistsRule ¶
type DenyIfViewerOutboundEdgeExistsRule struct { Policy ent.PrivacyPolicy EdgeType ent.EdgeType }
DenyIfViewerOutboundEdgeExistsRule is a privacy rule that passes if an edge exists between the viewer and the ent
func (DenyIfViewerOutboundEdgeExistsRule) Eval ¶
func (rule DenyIfViewerOutboundEdgeExistsRule) Eval(v viewer.ViewerContext, entity ent.Entity) ent.PrivacyResult
Eval evaluates the DenyIfViewerOutboundEdgeExistsRule privacy rule
type InlinePrivacyPolicy ¶
type InlinePrivacyPolicy struct {
PolicyRules []ent.PrivacyPolicyRule
}
InlinePrivacyPolicy is a policy that takes an ordered list of rules that determine what the access control for an ent or action is
func (InlinePrivacyPolicy) GetPrivacyPolicy ¶
func (p InlinePrivacyPolicy) GetPrivacyPolicy() ent.PrivacyPolicy
GetPrivacyPolicy returns the inline privacy policy as a privacy policy This enables InlinePrivacyPolicy to implement the interface ObjectWithPrivacyPolicy
func (InlinePrivacyPolicy) Rules ¶
func (p InlinePrivacyPolicy) Rules() []ent.PrivacyPolicyRule
Rules returns the given list of rules