Documentation ¶
Overview ¶
Package interceptors is middleware to alter the graphql query
Index ¶
- Variables
- func AddIDPredicate(ctx context.Context, q intercept.Query) error
- func FilterListQuery() ent.Interceptor
- func GetAuthorizedObjectIDs(ctx context.Context, objectType string) ([]string, error)
- func HistoryAccess(relation string, orgOwned, userOwed bool) ent.Interceptor
- func InterceptorAPIToken() ent.Interceptor
- func InterceptorGroup() ent.Interceptor
- func InterceptorHush() ent.Interceptor
- func InterceptorOrgMember() ent.Interceptor
- func InterceptorOrganization() ent.Interceptor
- func InterceptorOrganizationSetting() ent.Interceptor
- func InterceptorPat() ent.Interceptor
- func InterceptorUserSetting() ent.Interceptor
- func QueryLogger() ent.InterceptFunc
- func TraverseOrgMembers() ent.Interceptor
- func TraverseUser() ent.Interceptor
- type SkipMode
Constants ¶
This section is empty.
Variables ¶
var ( // ExistOperation is the operation type for Exist queries ExistOperation = "Exist" // IDsOperation is the operation type for IDs queries IDsOperation = "IDs" )
var ( // ErrInternalServerError is returned when an internal error occurs. ErrInternalServerError = errors.New("internal server error") // ErrUnableToRetrieveUserID is returned when the user cannot be retrieved from the context ErrUnableToRetrieveUserID = errors.New("unable to retrieve user from context") // ErrRetrievingObjects is returned when an error occurs while retrieving objects ErrRetrievingObjects = errors.New("error retrieving objects") )
Functions ¶
func AddIDPredicate ¶ added in v0.3.1
AddIDPredicate adds a predicate to the query to only include the objects that the user has access to This is generally used by object owned setups with the ObjectOwnedMixin
func FilterListQuery ¶ added in v0.3.1
func FilterListQuery() ent.Interceptor
FilterListQuery filters any list query to only include the objects that the user has access to
func GetAuthorizedObjectIDs ¶ added in v0.3.1
GetAuthorizedObjectIDs does a list objects request to pull all ids the current user has access to within the FGA system
func HistoryAccess ¶
func HistoryAccess(relation string, orgOwned, userOwed bool) ent.Interceptor
HistoryAccess is a traversal interceptor that checks if the user has the required role for the organization
func InterceptorAPIToken ¶
func InterceptorAPIToken() ent.Interceptor
InterceptorAPIToken is middleware to change the api token query
func InterceptorGroup ¶
func InterceptorGroup() ent.Interceptor
InterceptorGroup is middleware to change the Group query
func InterceptorHush ¶
func InterceptorHush() ent.Interceptor
InterceptorHush keeps it secret, keeps it safe
func InterceptorOrgMember ¶
func InterceptorOrgMember() ent.Interceptor
InterceptorOrgMember is middleware to change the OrgMember query result
func InterceptorOrganization ¶
func InterceptorOrganization() ent.Interceptor
InterceptorOrganization is middleware to change the Organization query
func InterceptorOrganizationSetting ¶
func InterceptorOrganizationSetting() ent.Interceptor
InterceptorOrganizationSetting is middleware to change the org setting query
func InterceptorPat ¶
func InterceptorPat() ent.Interceptor
InterceptorPat is middleware to change the PAT query
func InterceptorUserSetting ¶
func InterceptorUserSetting() ent.Interceptor
func QueryLogger ¶
func QueryLogger() ent.InterceptFunc
func TraverseOrgMembers ¶
func TraverseOrgMembers() ent.Interceptor
TraverseOrgMembers is middleware to change the Org Members query
func TraverseUser ¶
func TraverseUser() ent.Interceptor
TraverseUser returns an ent interceptor for user that filters users based on the context of the query
Types ¶
type SkipMode ¶
type SkipMode int
SkipMode is a bit flag for the Skip annotation.
const ( // SkipOnlyQuery skips the interceptor on `Only` queries. SkipOnlyQuery SkipMode = 1 << iota // SkipAllQuery skips the interceptor on `All` queries. SkipAllQuery // SkipExistsQuery skips the interceptor on `Exists` queries. SkipExistsQuery // SkipAll is default mode to skip all. SkipAll = SkipOnlyQuery | SkipAllQuery | SkipExistsQuery )