privacy

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

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

type AllowIfEdgeExistsRule

type AllowIfEdgeExistsRule struct {
	ID1      string
	ID2      string
	EdgeType ent.EdgeType
}

AllowIfEdgeExistsRule is a privacy rule that passes if an edge exists between the given IDs

func (AllowIfEdgeExistsRule) Eval

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

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

type AllowIfViewerInboundEdgeExistsRule

type AllowIfViewerInboundEdgeExistsRule struct {
	EdgeType ent.EdgeType
}

AllowIfViewerInboundEdgeExistsRule is a privacy rule that passes if an edge exists between the viewer and the ent

func (AllowIfViewerInboundEdgeExistsRule) Eval

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

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

type AllowIfViewerOutboundEdgeExistsRule struct {
	EdgeType ent.EdgeType
}

AllowIfViewerOutboundEdgeExistsRule is a privacy rule that passes if an edge exists between the viewer and the ent

func (AllowIfViewerOutboundEdgeExistsRule) Eval

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

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

type AlwaysAllowPrivacyPolicy struct {
	ent.Entity
}

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

Eval is the method called to evaluate the visibility of the ent and always returns AllowResult

type AlwaysDenyPrivacyPolicy

type AlwaysDenyPrivacyPolicy struct {
	ent.Entity
}

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

Eval is the method called to evaluate the visibility of the ent and always returns DenyResult

type AlwaysPanicPrivacyPolicy

type AlwaysPanicPrivacyPolicy struct {
	ent.Entity
}

func (AlwaysPanicPrivacyPolicy) GetPrivacyPolicy

func (p AlwaysPanicPrivacyPolicy) GetPrivacyPolicy() ent.PrivacyPolicy

type DenyIfEdgeExistsRule

type DenyIfEdgeExistsRule struct {
	ID1      string
	ID2      string
	EdgeType ent.EdgeType
}

DenyIfEdgeExistsRule is a privacy rule that passes if an edge exists between the given IDs

func (DenyIfEdgeExistsRule) Eval

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

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

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

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

Rules returns the given list of rules

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL