Documentation
¶
Overview ¶
Package hooks is middleware to alter the graphql mutation
this file calls the generated edge and history cleanup functions, which are excluded from compilation during code generation because they reference history packages that may not be generated yet, so this file must be excluded during codegen
Index ¶
- Constants
- Variables
- func AddOrDeletePublicStandardTuple(ctx context.Context, m *generated.StandardMutation) (bool, bool, error)
- func AllListeners() []gala.Registration
- func AuthEnforcementAttribution() ent.Hook
- func CampaignRecurringListeners() []gala.Registration
- func ControlVisibilityTupleAction(newVisibility, oldVisibility enums.TrustCenterControlVisibility, ...) (shouldWrite, shouldDelete bool)
- func DocumentAssociationListeners() []gala.Registration
- func DomainScanListeners() []gala.Registration
- func EmitGalaEventHook(runtimes ...*gala.Gala) ent.Hook
- func EntitlementListeners() []gala.Registration
- func FileBackupListeners() []gala.Registration
- func GetObjectIDFromEntValue(m ent.Value) (string, error)
- func GetObjectIDsFromMutation(ctx context.Context, m utils.GenericMutation, v ent.Value) ([]string, error)
- func GetObjectTypeFromEntMutation(m ent.Mutation) string
- func GetTuplesToAdd(ctx context.Context, m ent.Mutation, tr fgax.TupleRequest, edgeField string) ([]fgax.TupleKey, error)
- func HookAssetCreate() ent.Hook
- func HookBillingEmailChange() ent.Hook
- func HookBlockOwnerRoleChange() ent.Hook
- func HookCampaignTargetLinkUser() ent.Hook
- func HookContact() ent.Hook
- func HookControlImplementation() ent.Hook
- func HookControlReferenceFramework() ent.Hook
- func HookControlTrustCenterVisibility() ent.Hook
- func HookCreateAPIToken() ent.Hook
- func HookCreateAssessmentResponse() ent.Hook
- func HookCreateCustomDomain() ent.Hook
- func HookCreatePersonalAccessToken() ent.Hook
- func HookCreateTrustCenterDoc() ent.Hook
- func HookCustomEnums(in CustomEnumFilter) ent.Hook
- func HookCustomTypeEnumCreate() ent.Hook
- func HookCustomTypeEnumDelete() ent.Hook
- func HookDNSVerificationDelete() ent.Hook
- func HookDeleteCustomDomain() ent.Hook
- func HookDeleteDiscussion() ent.Hook
- func HookDeletePermissions() ent.Hook
- func HookDeleteUser() ent.Hook
- func HookDetailsVersion() ent.Hook
- func HookDirectoryAccountDelete() ent.Hook
- func HookDocumentDataFile() ent.Hook
- func HookDocumentDataTrustCenterNDA() ent.Hook
- func HookEdgePermissions() ent.Hook
- func HookEmailTemplateSanitize() ent.Hook
- func HookEmailValidation() ent.Hook
- func HookEmailVerificationToken() ent.Hook
- func HookEnableTFA() ent.Hook
- func HookEntityApprovedForUse() ent.Hook
- func HookEntityCreate() ent.Hook
- func HookEntityFiles() ent.Hook
- func HookEntityLogoFile() ent.Hook
- func HookEvidenceFiles() ent.Hook
- func HookEvidenceReviewDate() ent.Hook
- func HookExport() ent.Hook
- func HookExtractNotificationTemplateVariables() ent.Hook
- func HookFileDelete() ent.Hook
- func HookFileDownloadToken() ent.Hook
- func HookGroup() ent.Hook
- func HookGroupAuthz() ent.Hook
- func HookGroupMembers() ent.Hook
- func HookGroupPermissionsTuples() ent.Hook
- func HookGroupSettingVisibility() ent.Hook
- func HookIdentityHolderFiles() ent.Hook
- func HookIdentityHolderSoftDelete() ent.Hook
- func HookImpersonatorAttribution() ent.Hook
- func HookImportDocument() ent.Hook
- func HookIntegrationCampaignEmail() ent.Hook
- func HookIntegrationPrimaryDirectory() ent.Hook
- func HookInvite() ent.Hook
- func HookInviteAccepted() ent.Hook
- func HookInviteGroups() ent.Hook
- func HookManagedGroups() ent.Hook
- func HookMappedControl() ent.Hook
- func HookMembershipSelf(table string) ent.Hook
- func HookNoteFiles() ent.Hook
- func HookNotification() ent.Hook
- func HookNotificationPublish() ent.Hook
- func HookNotificationTemplateSanitize() ent.Hook
- func HookObjectOwnedTuples(parents []string, ownerRelation string) ent.Hook
- func HookOnboarding() ent.Hook
- func HookOrgMembers() ent.Hook
- func HookOrgMembersDelete() ent.Hook
- func HookOrgModule() ent.Hook
- func HookOrgModuleUpdate() ent.Hook
- func HookOrganization() ent.Hook
- func HookOrganizationCreatePolicy() ent.Hook
- func HookOrganizationDelete() ent.Hook
- func HookOrganizationUpdatePolicy() ent.Hook
- func HookPasswordResetToken() ent.Hook
- func HookPlatformFiles() ent.Hook
- func HookProgramAuthz() ent.Hook
- func HookProgramMembers() ent.Hook
- func HookProgramValidation() ent.Hook
- func HookPublicAccess() ent.Hook
- func HookQuestionnaireAssessment() ent.Hook
- func HookRelationTuples(objects map[string]string, relation fgax.Relation) ent.Hook
- func HookRequestor() ent.Hook
- func HookReviewFiles() ent.Hook
- func HookReviews() ent.Hook
- func HookRevisionUpdate() ent.Hook
- func HookRisks() ent.Hook
- func HookSeverityLevel() ent.Hook
- func HookSlateJSON() ent.Hook
- func HookStandardCreate() ent.Hook
- func HookStandardDelete() ent.Hook
- func HookStandardFileUpload() ent.Hook
- func HookStandardPublicAccessTuples() ent.Hook
- func HookStatusApproval() ent.Hook
- func HookSubcontrolCreate() ent.Hook
- func HookSubcontrolUpdate() ent.Hook
- func HookSubprocessor() ent.Hook
- func HookSubscriberCreate() ent.Hook
- func HookSubscriberUpdated() ent.Hook
- func HookSummarizeDetails() ent.Hook
- func HookSystemOwnedControls() ent.Hook
- func HookTagDefinition() ent.Hook
- func HookTagDefinitionDelete() ent.Hook
- func HookTags() ent.Hook
- func HookTaskCreate() ent.Hook
- func HookTaskPermissions() ent.Hook
- func HookTemplate() ent.Hook
- func HookTemplateFiles() ent.Hook
- func HookTrustCenter() ent.Hook
- func HookTrustCenterComplianceAuthz() ent.Hook
- func HookTrustCenterDelete() ent.Hook
- func HookTrustCenterEntityCreate() ent.Hook
- func HookTrustCenterEntityFiles() ent.Hook
- func HookTrustCenterFAQ() ent.Hook
- func HookTrustCenterNDARequestCreate() ent.Hook
- func HookTrustCenterNDARequestUpdate() ent.Hook
- func HookTrustCenterSetting() ent.Hook
- func HookTrustCenterSettingCreatePreview() ent.Hook
- func HookTrustCenterSubprocessor() ent.Hook
- func HookTrustCenterUpdate() ent.Hook
- func HookTrustCenterWatermarkConfig() ent.Hook
- func HookUpdateAPIToken() ent.Hook
- func HookUpdateAssessmentResponse() ent.Hook
- func HookUpdateManagedGroups() ent.Hook
- func HookUpdatePersonalAccessToken() ent.Hook
- func HookUpdateTrustCenterDoc() ent.Hook
- func HookUser() ent.Hook
- func HookUserCanViewTuple() ent.Hook
- func HookUserPermissions() ent.Hook
- func HookUserSetting() ent.Hook
- func HookUserSettingEmailConfirmation() ent.Hook
- func HookValidateIdentityProviderConfig() ent.Hook
- func HookVendorRiskScoreAggregate() ent.Hook
- func HookVendorRiskScoreCompute() ent.Hook
- func HookVendorScoringConfigKeyGen() ent.Hook
- func HookVerifyTFA() ent.Hook
- func HookWebauthnDelete() ent.Hook
- func HookWorkflowApprovalRouting() ent.Hook
- func HookWorkflowAssignmentDecisionAuth() ent.Hook
- func HookWorkflowDefinitionPrefilter() ent.Hook
- func HookWorkflowInstanceCascadeDelete() ent.Hook
- func HookWorkflowProposalInvalidateAssignments() ent.Hook
- func HookWorkflowProposalTriggerOnSubmit() ent.Hook
- func IdentityResolutionListeners() []gala.Registration
- func IntegrationCleanupListeners() []gala.Registration
- func IsUniqueConstraintError(err error) bool
- func IsValidEnumField(objectType, field string) bool
- func MetricsHook() ent.Hook
- func NDAAttestationListeners() []gala.Registration
- func OrgOwnedTuplesHook() ent.Hook
- func OrganizationAvatarListeners(opts ...OrganizationAvatarListenerOption) []gala.Registration
- func OrganizationCleanupListeners() []gala.Registration
- func QuestionnaireTransformListeners() []gala.Registration
- func RecomputeEntityRiskAggregate(ctx context.Context, client *generated.Client, entityID string) error
- func RegisterGlobalHooks(client *entgen.Client)
- func SetNewRevision(ctx context.Context, mut MutationWithRevision) error
- func SetTrustCenterConfig(cfg TrustCenterConfig)
- func StripInvalidChars(s string) string
- func SubscriberLinkListeners() []gala.Registration
- func TaskRuleListeners() []gala.Registration
- func TrustCenterCacheListeners() []gala.Registration
- func TrustCenterWatermarkListeners() []gala.Registration
- func ValidateIdentityProviderConfig(ctx context.Context, m *generated.OrganizationSettingMutation) error
- func VendorScoringListeners() []gala.Registration
- func WorkflowListeners() []gala.Registration
- func WorkflowMutationListeners() []gala.Registration
- type AvatarMutation
- type CustomEnumFilter
- type FileBackupRequest
- type MutationMember
- type MutationWithEmail
- type MutationWithRevision
- type OrgMember
- type OrganizationAvatarListenerOption
- type TaskLabelResolver
- type TrustCenterConfig
Constants ¶
const ( // AdminsGroup is the group name for all organization admins, super admins, and owners. // These users have full read and write access in the organization. AdminsGroup = "Admins" // ViewersGroup is the group name for all organization members that only have view access in the organization ViewersGroup = "Viewers" // AllMembersGroup is the group name for all members of the organization, no matter their role AllMembersGroup = "All Members" )
const MaxFileBackupAttempts = 5
MaxFileBackupAttempts caps replication retries before a file is marked exhausted
Variables ¶
var ( // ErrCustomEnumCreationFailed is returned when a custom enum value does not exist but is attempted to be set ErrCustomEnumCreationFailed = errors.New("enum value does not exist") // ErrCustomEnumInUse is returned when a custom enum is in use and cannot be deleted ErrCustomEnumInUse = errors.New("enum is in use") // ErrInvalidGlobalEnumField is returned when creating a global enum with an invalid field ErrInvalidGlobalEnumField = errors.New("invalid global enum field") )
var ( // ErrInternalServerError is returned when an internal error occurs. ErrInternalServerError = errors.New("internal server error") // ErrInvalidInput is returned when the input is invalid. ErrInvalidInput = errors.New("invalid input") // ErrPersonalOrgsNoChildren is returned when personal org attempts to add a child org ErrPersonalOrgsNoChildren = errors.New("personal organizations are not allowed to have child organizations") // ErrPersonalOrgsNoMembers is returned when personal org attempts to add members ErrPersonalOrgsNoMembers = errors.New("personal organizations are not allowed to have members other than the owner") // ErrOrgOwnerCannotBeDeleted is returned when an org owner is attempted to be deleted ErrOrgOwnerCannotBeDeleted = errors.New("organization owner cannot be deleted, it must be transferred to a new owner first") // ErrOrgOwnerCannotBeUpdated is returned when an org owner role is attempted to be changed directly via mutations ErrOrgOwnerCannotBeUpdated = errors.New("organization owner role cannot be changed directly, it must be transferred") // ErrPersonalOrgsNoUser is returned when personal org has no user associated, so no permissions can be added ErrPersonalOrgsNoUser = errors.New("personal organizations missing user association") // ErrUserNotInOrg is returned when a user is not a member of an organization when trying to add them to a group ErrUserNotInOrg = errors.New("user not in organization") // ErrUnsupportedFGARole is returned when a role is assigned that is not supported in our fine grained authorization system ErrUnsupportedFGARole = errors.New("unsupported role") // ErrMissingRole is returned when an update request is made that contains no role ErrMissingRole = errors.New("missing role in update") // ErrUserAlreadyOrgMember is returned when an user attempts to be invited to an org they are already a member of ErrUserAlreadyOrgMember = errors.New("user already member of organization") // ErrUserAlreadySubscriber is returned when an user attempts to subscribe to an organization but is already a subscriber ErrUserAlreadySubscriber = errors.New("subscriber already exists") // ErrEmailRequired is returned when an email is required but not provided ErrEmailRequired = errors.New("email is required but not provided") // ErrMaxAttempts is returned when a user has reached the max attempts to resend an invitation to an org ErrMaxAttempts = errors.New("too many attempts to resend org invitation") // ErrMaxAttemptsAssessments is returned when a user has reached the max attempts to resend an assessment ErrMaxAttemptsAssessments = errors.New("too many attempts to resend assessment invitation") // ErrMaxSubscriptionAttempts is returned when a user has reached the max attempts to subscribe to an org ErrMaxSubscriptionAttempts = errors.New("too many attempts to resend org subscription email") // ErrSubscribersNotAllowed is returned when a trust center is not accepting new subscribers ErrSubscribersNotAllowed = errors.New("trust center is not accepting new subscribers") // ErrAssessmentInCompleted is returned when attempting to resend an email for an assessment that is already completed ErrAssessmentInCompleted = errors.New("assessment is already completed") // ErrMissingRecipientEmail is returned when an email is required but not provided ErrMissingRecipientEmail = errors.New("recipient email is required but not provided") // ErrMissingRequiredName is returned when a name is required but not provided ErrMissingRequiredName = errors.New("name or display name is required but not provided") // ErrTooManyAvatarFiles is returned when a user attempts to upload more than one avatar file ErrTooManyAvatarFiles = errors.New("too many avatar files uploaded, only one is allowed") // ErrNoControls is returned when a subcontrol has no controls assigned ErrNoControls = errors.New("subcontrol must have at least one control assigned") // ErrUnableToCast is returned when a type assertion fails ErrUnableToCast = errors.New("unable to cast") // ErrNoSubscriptions is returned when an organization has no subscriptions ErrNoSubscriptions = errors.New("organization has no subscriptions") // ErrTooManySubscriptions is returned when an organization has too many subscriptions ErrTooManySubscriptions = errors.New("organization has too many subscriptions") // ErrTooManyPrices is returned when an organization has too many subscriptions ErrTooManyPrices = errors.New("organization has too many prices on a subscription") // ErrNoPrices is returned when a subscription has no price ErrNoPrices = errors.New("subscription has no price") // ErrManagedGroup is returned when a user attempts to modify a managed group ErrManagedGroup = errors.New("managed groups cannot be modified") // ErrMaxAttemptsOrganization is returned when the max attempts have been reached to create an organization via onboarding ErrMaxAttemptsOrganization = errors.New("too many attempts to create organization") // ErrUserNotFound is returned when a user is not found in the system ErrUserNotFound = errors.New("user not found") // ErrCronRequired is returned when a user does not provide a cron expression ErrCronRequired = errors.New("cron expression must be specified") // ErrZeroTimeNotAllowed is returned when you try to set a non usable time value ErrZeroTimeNotAllowed = errors.New("time cannot be empty. Provide a valid time/date") // ErrFutureTimeNotAllowed is returned when you try to set a time into the future. // future being any second/minute past the current time of validation ErrFutureTimeNotAllowed = errors.New("time cannot be in the future") // ErrPastTimeNotAllowed is returned when you try to set a time into the past. ErrPastTimeNotAllowed = errors.New("time cannot be in the past") // ErrFieldRequired is returned when a field is required but not provided ErrFieldRequired = errors.New("field is required but not provided") // ErrOwnerIDNotExists is returned when an owner_id cannot be found ErrOwnerIDNotExists = errors.New("owner_id is required") // ErrArchivedProgramUpdateNotAllowed is returned when an archived program is updated. It only // allows updates if the status is changed ErrArchivedProgramUpdateNotAllowed = errors.New("you cannot update an archived program") // ErrNotSingularUpload is returned when a user is importing content to create a schema // and they upload more than one file ErrNotSingularUpload = errors.New("multiple uploads not supported") // ErrSSONotEnforceable makes sure the connection has been tested before it can be enforced for an org ErrSSONotEnforceable = errors.New("you cannot enforce sso without testing the connection works correctly") // ErrUnableToDetermineEventID is returned when we cannot determine the event ID for an event ErrUnableToDetermineEventID = errors.New("unable to determine event ID") // ErrNotSingularTrustCenter is returned when an org is trying to create multiple trust centers ErrNotSingularTrustCenter = errors.New("you can only create/manage one trust center at a time") // ErrStatusApprovedNotAllowed is returned when a user attempts to set status to APPROVED without being in the approver or delegate group ErrStatusApprovedNotAllowed = errors.New("you must be in the approver group to mark as approved") // ErrInvalidChannel is returned when an invalid notification channel is provided ErrInvalidChannel = errors.New("invalid channel") // ErrTemplateIDRequired is returned when an assessment is created without a template ErrTemplateIDRequired = errors.New("template id required when creating an assessment") // ErrTemplateNotFound is returned when an assessment is created with a non existing template ErrTemplateNotFound = errors.New("template does not exist") // ErrTemplateNotQuestionnaire is returned when an assessment tries to use a wrong template type ErrTemplateNotQuestionnaire = errors.New("template must be a questionnaire") // ErrTrustCenterIDRequired is returned when the trustcenter id is not provided // when creating a customer for the trust center ErrTrustCenterIDRequired = errors.New("trustcenter entity must include a trustcenter id") // ErrUnableToCreateContact is returned when a contact could not be created ErrUnableToCreateContact = errors.New("unable to create a contact") // ErrUnableToCreateAssessmentResponse is returned when an assessment response could not be created ErrUnableToCreateAssessmentResponse = errors.New("unable to create assessment response") // ErrTooManyLogoFiles is returned when a user attempts to upload more than one logo file ErrTooManyLogoFiles = errors.New("too many logo files uploaded, only one is allowed") // ErrTooManyFaviconFiles is returned when a user attempts to upload more than one favicon file ErrTooManyFaviconFiles = errors.New("too many favicon files uploaded, only one is allowed") // ErrTooManyHeroImageFiles is returned when a user attempts to upload more than one hero image file ErrTooManyHeroImageFiles = errors.New("too many hero image files uploaded, only one is allowed") // ErrMissingTrustCenterID is returned when a trust center id is required but not provided ErrMissingTrustCenterID = errors.New("trust center id is required") // ErrMissingFileID is returned when a file id is required but not provided ErrMissingFileID = errors.New("missing file id") // ErrCannotSetFileOnCreate is returned when trying to set a file id on create mutations ErrCannotSetFileOnCreate = errors.New("cannot set file id on create") // ErrCacheRefreshFailed is returned when the cache refresh request fails ErrCacheRefreshFailed = errors.New("cache refresh request failed") // ErrNoOrganizationID is returned when no organization ID is found in context ErrNoOrganizationID = errors.New("no valid organization ID found") // ErrNDATemplateRequired is returned when nda requests mutation runs but there is no file for the // user to sign ErrNDATemplateRequired = errors.New("you need a nda template before a request can be made") // ErrMutationMissingID is returned when a mutation does not have an ID ErrMutationMissingID = errors.New("mutation missing ID") // ErrProposedChangesNotSupported is returned when proposed changes are not supported for a schema type ErrProposedChangesNotSupported = errors.New("proposed changes not supported for this schema type") // ErrFailedToGetUserFromContext is returned when the user cannot be resolved from the context ErrFailedToGetUserFromContext = errors.New("failed to get user from context") // ErrFailedToGetObjectOwnerID is returned when the owner id cannot be resolved for a workflow object ErrFailedToGetObjectOwnerID = errors.New("failed to get object owner id") // ErrFailedToQueryObjectRefs is returned when workflow object refs cannot be queried ErrFailedToQueryObjectRefs = errors.New("failed to query object refs") // ErrFailedToComputeProposalHash is returned when a workflow proposal hash cannot be computed ErrFailedToComputeProposalHash = errors.New("failed to compute proposal hash") // ErrFailedToQueryExistingProposal is returned when an existing proposal cannot be queried ErrFailedToQueryExistingProposal = errors.New("failed to query existing proposal") // ErrFailedToUpdateProposal is returned when a workflow proposal cannot be updated ErrFailedToUpdateProposal = errors.New("failed to update proposal") // ErrFailedToBeginTransaction is returned when a workflow transaction cannot be started ErrFailedToBeginTransaction = errors.New("failed to begin transaction") // ErrFailedToCreateWorkflowInstance is returned when a workflow instance cannot be created ErrFailedToCreateWorkflowInstance = errors.New("failed to create workflow instance") // ErrFailedToCreateWorkflowObjectRef is returned when a workflow object ref cannot be created ErrFailedToCreateWorkflowObjectRef = errors.New("failed to create workflow object ref") // ErrFailedToCreateWorkflowProposal is returned when a workflow proposal cannot be created ErrFailedToCreateWorkflowProposal = errors.New("failed to create workflow proposal inside of ent hooks") // ErrFailedToCreateWorkflowProposal is returned when a workflow proposal cannot be created ErrFailedToUpdateWorkflowProposal = errors.New("failed to update workflow proposal inside of ent hooks") // ErrFailedToLinkProposalToInstance is returned when a proposal cannot be linked to an instance ErrFailedToLinkProposalToInstance = errors.New("failed to link proposal to instance") // ErrFailedToCommitProposalTransaction is returned when proposal staging transaction cannot be committed ErrFailedToCommitProposalTransaction = errors.New("failed to commit proposal transaction") // ErrFailedToQueryAssignments is returned when workflow assignments cannot be queried ErrFailedToQueryAssignments = errors.New("failed to query assignments") // ErrFailedToInvalidateAssignment is returned when an assignment cannot be invalidated ErrFailedToInvalidateAssignment = errors.New("failed to invalidate assignment") // ErrWorkflowProposalMissingObjectRef is returned when a proposal is missing its object ref edge ErrWorkflowProposalMissingObjectRef = errors.New("workflow proposal missing object ref") // ErrFailedToDeriveObjectFromRef is returned when a workflow object cannot be derived from a ref ErrFailedToDeriveObjectFromRef = errors.New("failed to derive object from ref") // ErrFailedToLoadWorkflowObject is returned when a workflow object cannot be loaded ErrFailedToLoadWorkflowObject = errors.New("failed to load workflow object") // ErrFailedToFindMatchingDefinitions is returned when workflow definitions cannot be matched ErrFailedToFindMatchingDefinitions = errors.New("failed to find matching definitions") // ErrFailedToRecordAssignmentInvalidationEvent is returned when assignment invalidation events cannot be recorded ErrFailedToRecordAssignmentInvalidationEvent = errors.New("failed to record assignment invalidation event") // ErrFailedToResolveInvalidationNotificationOwner is returned when the owner for invalidation notifications cannot be resolved ErrFailedToResolveInvalidationNotificationOwner = errors.New("failed to resolve invalidation notification owner") // ErrFailedToSendInvalidationNotification is returned when invalidation notifications cannot be sent ErrFailedToSendInvalidationNotification = errors.New("failed to send invalidation notification") // ErrFailedToQueryWorkflowProposal is returned when a workflow proposal cannot be queried ErrFailedToQueryWorkflowProposal = errors.New("failed to query workflow proposal") // ErrFailedToQueryWorkflowInstances is returned when workflow instances cannot be queried ErrFailedToQueryWorkflowInstances = errors.New("failed to query workflow instances") // ErrFailedToLoadWorkflowProposalForTrigger is returned when a submitted proposal cannot be loaded for triggering ErrFailedToLoadWorkflowProposalForTrigger = errors.New("failed to load workflow proposal for trigger") // ErrFailedToResumeWorkflowInstance is returned when a workflow instance cannot be resumed ErrFailedToResumeWorkflowInstance = errors.New("failed to resume workflow instance") // ErrFailedToTriggerWorkflow is returned when a workflow cannot be triggered ErrFailedToTriggerWorkflow = errors.New("failed to trigger workflow") // ErrMissingIDForTrustCenterNDARequest is returned when a mutation for trust center nda request is missing the ID field, which is required to determine the trust center and send the appropriate email ErrMissingIDForTrustCenterNDARequest = errors.New("missing ID for trust center NDA request mutation") // ErrVendorScoringQuestionNotFound is returned when a question key cannot be resolved in the scoring config ErrVendorScoringQuestionNotFound = errors.New("vendor scoring question not found in config") // ErrStartDateLaterThanEndDate is returned when a program mutation has a start date that is later than the end date ErrStartDateLaterThanEndDate = errors.New("mutation's start date cannot be later than end date") // ErrFailedToGetOldEndDate is returned when a program mutation's old end date cannot be retrieved, which is necessary to validate that the start date is not later than the old end date ErrFailedToGetOldEndDate = errors.New("could not get old end date for mutation") // ErrFailedToGetStartDate is returned when a program mutation's start date cannot be retrieved, which is necessary to validate that the old start date is not later than the end date ErrFailedToGetOldStartDate = errors.New("could not get old start date for mutation") // ErrFailedToGetProgramByID is returned when a program cannot be retrieved by ID when updating ErrFailedToGetProgramByID = errors.New("could not get program by id when updating") // ErrFailedToGetIdsForProgramUpdate is returned when a program mutation's ids cannot be retrieved, which is necessary to validate bulk updates ErrFailedToGetIDsForProgramUpdate = errors.New("could not get ids for mutation program update") // ErrInvalidTemplateDefaults is returned when template defaults do not satisfy the template's jsonconfig schema ErrInvalidTemplateDefaults = errors.New("template defaults do not satisfy the template schema") // ErrMissingNDATemplateFile is returned when the NDA template has no attached file for attestation ErrMissingNDATemplateFile = errors.New("NDA template must have at least one attached file") // ErrFailedToUploadAttestedPDF is returned when the attested NDA PDF upload fails ErrFailedToUploadAttestedPDF = errors.New("failed to upload attested PDF") // ErrNoUploadedFiles is returned when the upload pipeline returns zero files ErrNoUploadedFiles = errors.New("no files returned from upload") // ErrFailedToAssociateFile is returned when linking an uploaded file to its document data record fails ErrFailedToAssociateFile = errors.New("failed to associate file with document data") // ErrFailedToFetchNDATemplate is returned when the NDA template cannot be queried ErrFailedToFetchNDATemplate = errors.New("failed to fetch NDA template") // ErrFailedToFetchNDATemplateFiles is returned when the template's file edges cannot be loaded ErrFailedToFetchNDATemplateFiles = errors.New("failed to fetch NDA template files") // ErrFailedToMarshalDocumentData is returned when document data cannot be serialized to JSON ErrFailedToMarshalDocumentData = errors.New("failed to marshal document data") // ErrFailedToUnmarshalNDAMetadata is returned when document data JSON cannot be deserialized into the NDA struct ErrFailedToUnmarshalNDAMetadata = errors.New("failed to unmarshal NDA metadata") // ErrFailedToDownloadNDAPDF is returned when the original NDA PDF cannot be downloaded from storage ErrFailedToDownloadNDAPDF = errors.New("failed to download original NDA PDF") // ErrFailedToCreateAttestedPDF is returned when appending the attestation page to the PDF fails ErrFailedToCreateAttestedPDF = errors.New("failed to create attested PDF") // ErrFailedToFetchTrustCenter is returned when the trust center record cannot be queried ErrFailedToFetchTrustCenter = errors.New("failed to fetch trust center") // ErrFailedToCreateAttestationCert is returned when generating the attestation certificate PDF page fails ErrFailedToCreateAttestationCert = errors.New("failed to create attestation certificate") // ErrFailedToMergeAttestationPage is returned when merging the attestation page into the original PDF fails ErrFailedToMergeAttestationPage = errors.New("failed to merge attestation page") // ErrFailedToGenerateAttestationPDF is returned when the attestation PDF output fails ErrFailedToGenerateAttestationPDF = errors.New("failed to generate attestation PDF") // ErrInvalidScope is returned when a scope is not assignable to service subjects ErrInvalidScope = errors.New("scope is not assignable to service subjects") // ErrMissingTaskTemplate indicates a rule fired but no taskrules.Template is registered for it ErrMissingTaskTemplate = errors.New("entityops: missing task template") // ErrExpressionNotList indicates an EachElement expression evaluated to a non-list value ErrExpressionNotList = errors.New("entityops: expression did not evaluate to a list") // ErrQuestionnaireTransformInvalid is returned when a questionnaire transform configuration or submission cannot map to its target ErrQuestionnaireTransformInvalid = errors.New("questionnaire transform invalid") // ErrClientResolveFailed indicates the ent client could not be resolved from the context ErrClientResolveFailed = errors.New("client resolve failed") )
var ( // ErrPublicStandardCannotBeDeleted defines an error that denotes a public standard cannot be // deleted once made public ErrPublicStandardCannotBeDeleted = errors.New("public standard not allowed to be deleted") // ErrStandardInUseByControls defines an error that denotes a standard cannot be deleted // because it is in use by active controls in the system ErrStandardInUseByControls = errors.New("standard cannot be deleted because it is in use by one or more controls") // ErrStandardInUseByTrustCenter defines an error that denotes a standard cannot be deleted // because it is in use by an active trust center ErrStandardInUseByTrustCenter = errors.New("standard cannot be deleted because it is in use by a trust center") // ErrSystemOwnedStandardCannotBeDeleted defines an error that denotes a system-owned standard // can only be deleted by a system admin ErrSystemOwnedStandardCannotBeDeleted = errors.New("system-owned standard can only be deleted by a system admin") )
var ( // ErrTagDefinitionInUse is returned when a tag definition is in use and cannot be deleted ErrTagDefinitionInUse = errors.New("tag definition is in use") // ErrTagDefinitionInUse is returned when there is a db level error fetching all org owned tags ErrTagsNotFetched = errors.New("an error occurred while fetching all tags") )
var ErrFileBackupExhausted = errors.New("file backup exhausted max attempts")
ErrFileBackupExhausted marks a replication that hit the attempt cap and will not be retried
var ErrTextContainsComments = errors.New("text contains comments, unable to set description due to potential loss of data in conversion")
ErrTextContainsComments is returned when attempting to set a text field with a corresponding JSON field that contains comments, this will cause the comment links to be lost in conversion and is not allowed
var FileBackupTopic = gala.NamespacedTopic(gala.System, "file.backup.requested", gala.WithUniqueKey(func(req FileBackupRequest) string { return "file-backup-" + req.FileID }), )
FileBackupTopic carries explicit replication requests to enable backfill of backups
Functions ¶
func AddOrDeletePublicStandardTuple ¶
func AddOrDeletePublicStandardTuple(ctx context.Context, m *generated.StandardMutation) (bool, bool, error)
AddOrDeletePublicStandardTuple determines whether to add or delete a standard tuple based on the mutation operation and field values.
Parameters: - ctx: The context for the operation. - m: The StandardMutation containing the mutation details.
Returns: - add: A boolean indicating whether to add the tuple. - delete: A boolean indicating whether to delete the tuple. - err: An error if any occurred during the operation.
The function handles the following mutation operations: - OpCreate: Adds the tuple if both systemOwned and isPublic are true. - OpDelete, OpDeleteOne: Deletes the tuple. - OpUpdateOne: Deletes the tuple if it's a soft delete or if isPublic fields has changed. Adds the tuple if both fields are true. - OpUpdate: Deletes the tuple if isPublic field has been cleared. Adds the tuple if both fields are true.
func AllListeners ¶ added in v2.4.1
func AllListeners() []gala.Registration
AllListeners builds the registrations for every listener family in this package; the constructors run on each call so they observe the current schema registry
func AuthEnforcementAttribution ¶
AuthEnforcementAttribution stamps the grantor and timestamp when a membership's SSO exemption or TFA enforcement is set, and clears the attribution and reason when the policy is removed. The grantor defaults to the acting caller when it is not explicitly provided by the mutation, which lets API driven grants record who performed the change while server driven flows can attribute it to a specific user
func CampaignRecurringListeners ¶
func CampaignRecurringListeners() []gala.Registration
CampaignRecurringListeners keeps recurring campaign scheduling in sync when activation or recurrence fields change
func ControlVisibilityTupleAction ¶
func ControlVisibilityTupleAction(newVisibility, oldVisibility enums.TrustCenterControlVisibility, visibilityChanged bool) (shouldWrite, shouldDelete bool)
ControlVisibilityTupleAction determines whether wildcard viewer tuples should be written or deleted based on the trust center visibility state of a control. The caller is responsible for ensuring this is only called for trust center controls.
func DocumentAssociationListeners ¶
func DocumentAssociationListeners() []gala.Registration
DocumentAssociationListeners links controls referenced in a new document's details
func DomainScanListeners ¶
func DomainScanListeners() []gala.Registration
DomainScanListeners submits pending domain scans and requests scans for changed organization domains
func EmitGalaEventHook ¶
EmitGalaEventHook returns a hook that emits Gala mutation envelopes after mutations. Runtimes are deduplicated once at installation; a mutation fans out to every concern topic each runtime has an interested listener for, one envelope per mutated row
func EntitlementListeners ¶
func EntitlementListeners() []gala.Registration
EntitlementListeners keeps Stripe customers and subscriptions in sync with organization lifecycle and billing changes
func FileBackupListeners ¶ added in v2.4.1
func FileBackupListeners() []gala.Registration
FileBackupListeners replicates a file to its configured backup provider once the file's storage location has been written
func GetObjectIDFromEntValue ¶
GetObjectIDFromEntValue extracts the object id from a generic ent value return type this function should be called after the mutation has been successful
func GetObjectIDsFromMutation ¶
func GetObjectIDsFromMutation(ctx context.Context, m utils.GenericMutation, v ent.Value) ([]string, error)
GetObjectIDsFromMutation gets the object ids from the mutation, if it is a create it will use the ent.Value to get the id, requiring the mutation be executed first For updates, it will use the `IDs()` function to get the IDs by querying the database and returning the entity ids that match the mutation's predicate.
func GetObjectTypeFromEntMutation ¶
GetObjectTypeFromEntMutation gets the object type from the ent mutation
func GetTuplesToAdd ¶
func GetTuplesToAdd(ctx context.Context, m ent.Mutation, tr fgax.TupleRequest, edgeField string) ([]fgax.TupleKey, error)
GetTuplesToAdd is the generic function to get the tuples that need to be added to the authz service based on the edges that were added it is recommend to use the helper functions that call this instead of calling this directly for example, to add a parent relationship, use createParentTuples, or for an org owner relationship, use createOrgOwnerParentTuple this takes in the tuple request and sets the subject and subject id based on the edge field and tuple set relation
func HookAssetCreate ¶
HookAssetCreate sets the display name for assets everytime one is created
func HookBillingEmailChange ¶
HookBillingEmailChange is triggered when the billing_email field is updated on an organization setting.
func HookBlockOwnerRoleChange ¶
HookBlockOwnerRoleChange blocks direct owner role changes and enforces it goes through the transfer route
func HookCampaignTargetLinkUser ¶
HookCampaignTargetLinkUser links campaign targets to existing users by email.
func HookControlImplementation ¶
HookControlImplementation sets default values for the control implementation
func HookControlReferenceFramework ¶
HookControlReferenceFramework runs on control mutations to set the reference framework based on the standard's short name
func HookControlTrustCenterVisibility ¶
HookControlTrustCenterVisibility manages FGA wildcard viewer tuples when the trust_center_visibility field changes on a control, enabling or revoking anonymous public access based on the visibility state
func HookCreateAPIToken ¶
HookCreateAPIToken runs on api token mutations and sets the owner id
func HookCreateAssessmentResponse ¶
HookCreateAssessmentResponse sends the email to the user to fill in and input their data. It also makes sure to bump up the send attempts if needed. The hook is idempotent: multiple create calls for the same assessment/email/campaign combination will update the existing record rather than creating duplicates.
func HookCreateCustomDomain ¶
HookCustomDomain runs on create mutations
func HookCreatePersonalAccessToken ¶
HookCreatePersonalAccessToken runs on access token mutations and sets the owner id
func HookCreateTrustCenterDoc ¶
HookCreateTrustCenterDoc is an ent hook that processes file uploads and sets appropriate fields and permissions on create
func HookCustomEnums ¶
func HookCustomEnums(in CustomEnumFilter) ent.Hook
HookCustomEnums ensures that a custom enum value exists for the given object type and field It looks up the enum by name and sets the corresponding edge field on the mutation
func HookCustomTypeEnumCreate ¶
HookCustomTypeEnumCreate validates that the object_type and field combination is valid
func HookCustomTypeEnumDelete ¶
HookCustomTypeEnumDelete checks if the enum(s) being deleted is in use by any other object. If in use, the deletion cannot proceed
func HookDNSVerificationDelete ¶
HookDNSVerificationDelete cleans up preview domain DNS records when a verification record is deleted
func HookDeleteCustomDomain ¶
HookDeleteCustomDomain runs on single and bulk deletions.
func HookDeleteDiscussion ¶
HookDeleteDiscussionDelete deletes the discussion when the last comment is deleted
func HookDeletePermissions ¶
HookDeletePermissions is an ent hook that deletes all relationship tuples associated with an object on either delete or soft-delete operations
func HookDeleteUser ¶
HookDeleteUser runs on user deletions to clean up personal organizations
func HookDetailsVersion ¶
HookDetailsVersion is an ent hook that parses the versions from the details of a document creation
func HookDirectoryAccountDelete ¶
HookDirectoryAccountDelete syncs identity holder email aliases after a directory account is removed, since the async listener cannot look up the deleted row
func HookDocumentDataFile ¶
HookDocumentDataFile handles file uploads and attaches them to document data. restricted to system admins updating NDA documents only for now in riverqueue. the old/regular case of adding FileIDs to mutations will still be accepted for non admins.
func HookDocumentDataTrustCenterNDA ¶
HookDocumentDataTrustCenterNDA runs on document data create mutations to ensure trust center NDA document submissions are valid
func HookEdgePermissions ¶
HookEdgePermissions runs on edge mutations to ensure the user has access to the object they are trying to add for edges. It uses the accessmap generated to get the object type and checks if the user has access to it.
func HookEmailTemplateSanitize ¶
HookEmailTemplateSanitize sanitizes customer-supplied fields on email template create and update mutations. String values in the defaults map are scrubbed of HTML tags to prevent stored XSS; Go template expressions like {{ .companyName }} pass through unmodified since they are not HTML
func HookEmailValidation ¶
HookEmailValidation runs on user mutations to validate email addresses to ensure they meet the configured criteria which could include checks for disposable, free, or role-based emails. Additionally, it can set a default avatar using Gravatar if no avatar is provided during user creation. This hook only accepts mutations that implement the MutationWithEmail interface or are Invite mutations, which used the recipient field.
func HookEmailVerificationToken ¶
HookEmailVerificationToken runs on email verification mutations and sets expires
func HookEnableTFA ¶
HookEnableTFA is a hook that generates the tfa secrets if the totp setting is set to allowed
func HookEntityApprovedForUse ¶
HookEntityApprovedForUse sets approved_for_use based on the entity status.
func HookEntityCreate ¶
HookEntityCreate runs on entity mutations to set default values that are not provided
func HookEntityFiles ¶
HookEntityFiles runs on entity mutations to check for uploaded files
func HookEntityLogoFile ¶
HookEntityLogoFile runs on entity mutations to check for an uploaded logo file
func HookEvidenceFiles ¶
HookEvidenceFiles runs on evidence mutations to check for uploaded files
func HookEvidenceReviewDate ¶
HookEvidenceReviewDate runs on evidence mutations and calculate the next review time based on creation date + review frequency
func HookExport ¶
func HookExtractNotificationTemplateVariables ¶
HookExtractNotificationTemplateVariables parses template content fields on create and update, extracts Go template variable references, and merges them as properties into jsonconfig. Existing jsonconfig properties are preserved; only newly discovered variables are added. System-reserved field names (CompanyName, Recipient, URLS, etc.) are filtered out so jsonconfig only describes user-supplied inputs. When defaults are also set in the mutation, they are validated against the finalized schema.
func HookFileDelete ¶
HookFileDelete makes sure to clean up the file from external storage once deleted
func HookFileDownloadToken ¶
HookPasswordResetToken runs on reset token mutations and sets expires
func HookGroupAuthz ¶
HookGroupAuthz runs on group mutations to setup or remove relationship tuples
func HookGroupMembers ¶
HookGroupMembers checks the users role, ensures they are a member of the org, and prevents direct modifications to managed groups unless the caller has the bypass capability
func HookGroupPermissionsTuples ¶
HookGroupPermissionsTuples is a hook that adds group permissions tuples for the object being created this is the reverse edge of the object owned tuples, meaning these run on group mutations whereas the other hooks run on the object mutations
func HookGroupSettingVisibility ¶
HookGroupSettingVisibility is a hook that updates the conditional tuples for group settings based on the visibility setting changing the initial tuple is set up on group creation
func HookIdentityHolderFiles ¶
HookIdentityHolderFiles runs on identity holder mutations to check for uploaded files
func HookIdentityHolderSoftDelete ¶
HookIdentityHolderSoftDelete clears identity_holder_id on linked directory accounts when an identity holder is soft-deleted, preventing stale foreign key references
func HookImpersonatorAttribution ¶
HookImpersonatorAttribution stamps the acting impersonator onto a record when the mutation is performed during an impersonation session (for example an Openlane support session). The record's created_by/updated_by still reflect the impersonated identity, while updated_by_impersonator records the real actor behind the session so changes remain traceable to a specific person. When the mutation is not impersonated the field is cleared so it reflects the most recent actor
func HookImportDocument ¶
HookImportDocument is an ent hook that imports document content from either an uploaded file or a provided URL If a file is uploaded it becomes the source of the details and sets the document name to the original filename
func HookIntegrationCampaignEmail ¶
HookIntegrationCampaignEmail enforces the one-campaign-email-per-org invariant. When an integration is flagged as the campaign email provider, all sibling integrations in the same organization have their campaign_email flag cleared
func HookIntegrationPrimaryDirectory ¶
HookIntegrationPrimaryDirectory enforces the one-primary-directory-per-org invariant When an integration is set as the primary directory, all sibling integrations in the same organization have their primary_directory flag cleared
func HookInviteAccepted ¶
HookInviteAccepted adds the user to the organization when the status is accepted and any groups specified in the invite
func HookInviteGroups ¶
HookInviteGroups checks the user has access to the groups specified in the invite mutation before allowing the mutation to proceed users must have edit access to the group to be able to add an invite
func HookManagedGroups ¶
HookManagedGroups runs on group mutations to prevent updates to managed groups
func HookMappedControl ¶
HookMappedControl runs on mapped control create and update mutations to restrict certain fields to system admins only
func HookMembershipSelf ¶
HookMembershipSelf is a hook that runs on membership mutations to prevent users from updating their own membership
func HookNoteFiles ¶
HookNoteFiles runs on note mutations to check for uploaded files
func HookNotification ¶
HookNotification runs on notification mutations to validate channels
func HookNotificationPublish ¶
HookNotificationPublish runs after notification creation to publish to subscribers
func HookNotificationTemplateSanitize ¶
HookNotificationTemplateSanitize sanitizes template content fields on create and update for non-system-owned notification templates. System-owned templates are loaded via harmonize and are trusted. Body content is sanitized with the email-aware bluemonday policy; title and subject fields are stripped of all HTML tags.
func HookObjectOwnedTuples ¶
HookObjectOwnedTuples is a hook that adds object owned tuples for the object being created given a set of parent id fields, it will add the user and parent permissions to the object on creation by default, it will always add a user permission to the object ownerRelation should normally be set to fgax.ParentRelation, but in some cases this is set to owner to account for different inherited permissions from parent objects vs. the user/service owner of the object (see notes as an example)
func HookOnboarding ¶
HookOnboarding runs on onboarding mutations to create the organization and settings
func HookOrgMembers ¶
func HookOrgMembersDelete ¶
HookOrgMembersDelete is a hook that runs during the delete operation of an org membership
func HookOrgModule ¶
HookOrgModule adds the feature tuples to fga as needed
func HookOrgModuleUpdate ¶
HookOrgModuleUpdate updates the feature tuple in fga based off the module status in the database
func HookOrganization ¶
HookOrganization runs on org mutations to set default values that are not provided
func HookOrganizationCreatePolicy ¶
HookOrganizationCreatePolicy is used on organization and organization setting creation mutations if the allowed email domains are set, it will create a conditional tuple that restricts access to the organization based on the email domain
func HookOrganizationDelete ¶
HookOrganizationDelete runs on org delete mutations to ensure the org can be deleted
func HookOrganizationUpdatePolicy ¶
HookOrganizationUpdatePolicy is used on organization setting mutations where the allowed email domains are set in the request it will update the conditional tuple that restricts access to the organization based on the email domain
func HookPasswordResetToken ¶
HookPasswordResetToken runs on reset token mutations and sets expires
func HookPlatformFiles ¶
HookPlatformFiles runs on platform mutations to check for uploaded files
func HookProgramAuthz ¶
HookProgramAuthz runs on program mutations to setup or remove relationship tuples and prevents updates to archived programs - except if the update contains status changes too
func HookProgramMembers ¶
HookProgramMembers is a hook that ensures that the user is a member of the organization before allowing them to be added to a program TODO (sfunk): can this be generic across all edges with users that are owned by an organization?
func HookProgramValidation ¶
HookProgramValidation validates that the start date is before the end date on program's created and updated
func HookPublicAccess ¶
HookCreatePublicAccess adds public access (wildcard tuples) to the created object for system owned objects. Deletion of tuples is handled by the global HookDeletePermissions hook
func HookQuestionnaireAssessment ¶
HookQuestionnaireAssessment is a hook that checks if the templatate associated with the assessment is a questionnaire
func HookRelationTuples ¶
HookRelationTuples is a hook that adds tuples for the object being created the objects input is a map of object id fields to the object type these tuples based are based on the direct relation, e.g. a group#member to another object this is the reverse of the HookGroupPermissionsTuples
func HookRequestor ¶
HookRequestor sets the requestor_id field on create mutations
func HookReviewFiles ¶
HookReviewFiles runs on review mutations to check for uploaded files
func HookReviews ¶
HookReviews runs on review mutations to process and update the entities tied to the review
func HookRevisionUpdate ¶
HookRevisionUpdate is a hook that runs on update mutations to handle the revision of an object It checks if the revision is set, and if not, it retrieves the current revision from the database and bumps the patch version if just metadata was updated, bumps minor for details or details_json updates If the revision is cleared, it sets the revision to the default value
func HookSeverityLevel ¶
HookSeverityLevel sets the security_level based on the score field using CVSS v4.0 ranges
func HookSlateJSON ¶
HookSlateJSON is an ent hook that will handle clearing JSON fields if description is set, this will prevent stale JSON data from remaining when a user sets description via the API (or bulk csv operations) that does not include the JSON field data
func HookStandardCreate ¶
HookStandardCreate sets default values on creation, such as setting the short name to the name if it's not provided
func HookStandardDelete ¶
HookStandardDelete blocks deletion of a standard that is in use by trust center compliances. For system-owned standards, it cascades the deletion by clearing standard_id from org-owned controls and deleting system-owned controls. For non-system-owned standards, it blocks deletion if controls exist.
func HookStandardFileUpload ¶
func HookStandardPublicAccessTuples ¶
HookStandardPublicAccessTuples adds tuples for publicly available standards based on the system owned and isPublic fields; and deletes them when the fields are cleared. see AddOrDeleteStandardTuple for details on how the fields are checked and it's called functions for specifics on mutation types
func HookStatusApproval ¶
HookStatusApproval is an ent hook that ensures only users in the approver or delegate group can set status to APPROVED
func HookSubcontrolCreate ¶
HookSubcontrolCreate sets default values for the subcontrol on creation
func HookSubcontrolUpdate ¶
HookSubcontrolUpdate ensures that there is at least 1 control assigned to the subcontrol
func HookSubprocessor ¶
HookSubprocessor runs on subprocessor mutations to check for uploaded logo file
func HookSubscriberCreate ¶
HookSubscriberCreate runs on subscriber create mutations
func HookSubscriberUpdated ¶
HookSubscriberUpdated runs on subscriber update mutations to set the active status to false if the user is unsubscribed
func HookSummarizeDetails ¶
HookSummarizeDetails is an ent hook that summarizes long details fields into a short human readable summary
func HookSystemOwnedControls ¶
HookSystemOwnedControls runs on mutations to check for system owned controls since only view access to a control is required for edges on tasks, evidence, this ensures that system owned controls are not linked to org owned objects
func HookTagDefinition ¶
func HookTagDefinitionDelete ¶
HookTagDefinitionDelete checks if the tag definition(s) being deleted is in use by any workflow definition. If in use, the deletion cannot proceed
func HookTags ¶
HookTags will create tag definitions if they do not already exist when tags are added to an entity
func HookTaskCreate ¶
HookTaskCreate runs on task create mutations to set default values that are not provided this will set the assigner to the current user if it is not provided
func HookTaskPermissions ¶
HookTaskPermissions runs on task create and update mutations to add and remove the assignee tuple
func HookTemplate ¶
HookTemplate runs on template create and update mutations
func HookTemplateFiles ¶
func HookTrustCenter ¶
HookTrustCenter runs on trust center create mutations
func HookTrustCenterComplianceAuthz ¶
HookTrustCenterComplianceAuthz runs on trust center compliance mutations to setup or remove relationship tuples
func HookTrustCenterDelete ¶
HookTrustCenterDelete runs on trust center delete mutations
func HookTrustCenterEntityCreate ¶
HookTrustCenterEntityCreate scopes the entity to the customer type by default. If the customer entity does not exist ( maybe old orgs ), it creates it before proceeding to the trustcenter entity creation
func HookTrustCenterEntityFiles ¶
HookTrustCenterEntityFiles runs on trustcenter entity mutations and checks for an uploaded logo file
func HookTrustCenterFAQ ¶
HookTrustCenterFAQ sets the trustcenter ID on the note so it is always accessible.
func HookTrustCenterNDARequestCreate ¶
HookTrustCenterNDARequestCreate handles new NDA request creation
func HookTrustCenterNDARequestUpdate ¶
HookTrustCenterNDARequestUpdate handles NDA request status updates - sends email when approved
func HookTrustCenterSetting ¶
HookTrustCenterSetting process files for trust center settings
func HookTrustCenterSettingCreatePreview ¶
HookTrustCenterSettingCreatePreview is a hook that runs on trust center setting create or update to enqueue a job to create the preview domain
func HookTrustCenterSubprocessor ¶
HookTrustCenterSubprocessor adds parent relationship tuples on create of trust center subprocessors for the subprocessor, allowing trust center access
func HookTrustCenterUpdate ¶
HookTrustCenterUpdate runs on trust center update mutations
func HookTrustCenterWatermarkConfig ¶
HookTrustCenterWatermarkConfig process files for trust center watermark config
func HookUpdateAPIToken ¶
HookUpdateAPIToken runs on api token update and redacts the token
func HookUpdateAssessmentResponse ¶
HookUpdateAssessmentResponse validates status transitions and checks if the assessment response is past due. Completed is a terminal state. Draft can only be set if already in draft.
func HookUpdateManagedGroups ¶
HookUpdateManagedGroups runs when org members are added to add the users to the system managed groups
func HookUpdatePersonalAccessToken ¶
HookUpdatePersonalAccessToken runs on access token update and redacts the token
func HookUpdateTrustCenterDoc ¶
HookUpdateTrustCenterDoc is an ent hook that processes file uploads and sets appropriate fields and permissions on update
func HookUser ¶
HookUser runs on user mutations validate and hash the password and set default values that are not provided
func HookUserCanViewTuple ¶
HookUserCanViewTuple adds the user#can_view relation for the created object it is agnostic to the object type so it can be used on any schema
func HookUserPermissions ¶
HookUserPermissions runs on user creations to add user _self permissions these are used for parent inherited relations on other objects in the system
func HookUserSetting ¶
HookUserSetting runs on user settings mutations and validates input on update
func HookUserSettingEmailConfirmation ¶
HookUserSettingEmailConfirmation runs on user settings mutations and handles auto-join when email is confirmed and sends welcome email after verification
func HookValidateIdentityProviderConfig ¶
HookValidateIdentityProviderConfig ensures identity provider configuration is present when SSO login is enforced and resets the enforced/tested status whenever any SSO configuration field changes
func HookVendorRiskScoreAggregate ¶
HookVendorRiskScoreAggregate recomputes Entity.risk_score and Entity.risk_rating after a VendorRiskScore is created, updated, or deleted
func HookVendorRiskScoreCompute ¶
HookVendorRiskScoreCompute sets the score field based on impact x likelihood, and populates denormalized question fields from the scoring config on create
func HookVendorScoringConfigKeyGen ¶
HookVendorScoringConfigKeyGen assigns stable keys to custom questions that lack a generated CUST-prefix key before the config is persisted
func HookVerifyTFA ¶
HookVerifyTFA is a hook that will generate recovery codes and enable TFA for a user if the TFA has been verified
func HookWebauthnDelete ¶
HookWebauthnDelete runs on passkey delete mutations to ensure that we update the user's settings if needed
func HookWorkflowApprovalRouting ¶
HookWorkflowApprovalRouting intercepts mutations on workflowable schemas and routes them to WorkflowProposal when a matching workflow definition with approval requirements exists. This enables the "proposed changes" pattern where mutations require approval before being applied.
func HookWorkflowAssignmentDecisionAuth ¶
HookWorkflowAssignmentDecisionAuth ensures only assignment targets can approve/reject.
func HookWorkflowDefinitionPrefilter ¶
HookWorkflowDefinitionPrefilter derives prefilter fields from the definition JSON.
func HookWorkflowInstanceCascadeDelete ¶
HookWorkflowInstanceCascadeDelete removes workflow-related child records when instances are deleted.
func HookWorkflowProposalInvalidateAssignments ¶
HookWorkflowProposalInvalidateAssignments invalidates approved assignments when a SUBMITTED proposal is edited
func HookWorkflowProposalTriggerOnSubmit ¶
HookWorkflowProposalTriggerOnSubmit triggers workflows when a proposal transitions to SUBMITTED state
func IdentityResolutionListeners ¶
func IdentityResolutionListeners() []gala.Registration
IdentityResolutionListeners resolves directory accounts to identity holders after mutations commit
func IntegrationCleanupListeners ¶
func IntegrationCleanupListeners() []gala.Registration
IntegrationCleanupListeners purges queued integration jobs on removal or disconnect and reseeds them on reconnect
func IsUniqueConstraintError ¶
IsUniqueConstraintError reports if the error resulted from a DB uniqueness constraint violation. e.g. duplicate value in unique index.
func IsValidEnumField ¶
IsValidEnumField returns true if any table has a column matching the object type and field pattern For global enums (empty objectType), checks for {field}_id columns For object-scoped enums, checks for {objectType}_{field}_id columns
func MetricsHook ¶
MetricsHook inits the collectors with count total at beginning, error on mutation error and a duration after the mutation
func NDAAttestationListeners ¶
func NDAAttestationListeners() []gala.Registration
NDAAttestationListeners attests signed trust center NDAs after document data creation
func OrgOwnedTuplesHook ¶
OrgOwnedTuplesHook is a hook that adds organization owned tuples for the object being created it will only add the parent organization permissions, and no specific user permissions
func OrganizationAvatarListeners ¶
func OrganizationAvatarListeners(opts ...OrganizationAvatarListenerOption) []gala.Registration
OrganizationAvatarListeners discovers an avatar from the organization's domains after creation
func OrganizationCleanupListeners ¶
func OrganizationCleanupListeners() []gala.Registration
OrganizationCleanupListeners cascades an organization soft delete by hard-deleting everything it owns
func QuestionnaireTransformListeners ¶
func QuestionnaireTransformListeners() []gala.Registration
QuestionnaireTransformListeners transforms completed questionnaire document data into entities using the template's transform configuration
func RecomputeEntityRiskAggregate ¶
func RecomputeEntityRiskAggregate(ctx context.Context, client *generated.Client, entityID string) error
RecomputeEntityRiskAggregate recalculates an entity's aggregate risk_score, risk_rating, and risk_score_coverage from all VendorRiskScore records, respecting the scoring mode on the associated VendorScoringConfig
func RegisterGlobalHooks ¶
RegisterGlobalHooks registers global hooks shared across runtime modes.
func SetNewRevision ¶
func SetNewRevision(ctx context.Context, mut MutationWithRevision) error
SetNewRevision sets the new revision for a mutation based on the current revision and the revision bump If the revision is set, it does nothing If the revision is not set, it retrieves the current revision from the database and bumps the version based on the revision bump If there is no revision bump set, it bumps the patch version
func SetTrustCenterConfig ¶
func SetTrustCenterConfig(cfg TrustCenterConfig)
SetTrustCenterConfig sets the trust center configuration. It also populates the shared trustcenterurl config so the integration runtime can build trust center links without importing this package
func StripInvalidChars ¶
StripInvalidChars removes invalid characters from a string
func SubscriberLinkListeners ¶
func SubscriberLinkListeners() []gala.Registration
SubscriberLinkListeners links a newly created subscriber to an existing contact and/or user with a matching email
func TaskRuleListeners ¶
func TaskRuleListeners() []gala.Registration
TaskRuleListeners evaluates schema task rules on mutation and creates suggested tasks
func TrustCenterCacheListeners ¶
func TrustCenterCacheListeners() []gala.Registration
TrustCenterCacheListeners refreshes the trust center cache when trust-center-linked records change, including soft deletes
func TrustCenterWatermarkListeners ¶
func TrustCenterWatermarkListeners() []gala.Registration
TrustCenterWatermarkListeners enqueues watermarking jobs when trust center document files change
func ValidateIdentityProviderConfig ¶
func ValidateIdentityProviderConfig(ctx context.Context, m *generated.OrganizationSettingMutation) error
ValidateIdentityProviderConfig checks if the identity provider configuration is valid the intent of the function is to ensure all necessary identity provider configuration fields are present and valid when SSO enforcement is being set to active, while also supporting partial updates by falling back to existing values when appropriate
func VendorScoringListeners ¶
func VendorScoringListeners() []gala.Registration
VendorScoringListeners recomputes entity risk aggregates when vendor scoring configuration changes
func WorkflowListeners ¶
func WorkflowListeners() []gala.Registration
WorkflowListeners wires workflow mutations and command events to the workflow engine
func WorkflowMutationListeners ¶
func WorkflowMutationListeners() []gala.Registration
WorkflowMutationListeners forwards workflow-eligible mutations to the workflow engine
Types ¶
type AvatarMutation ¶
type AvatarMutation interface {
pkgobjects.Mutation
SetAvatarLocalFileID(s string)
SetAvatarUpdatedAt(t time.Time)
}
AvatarMutation is an interface for setting the local file ID for an avatar
type CustomEnumFilter ¶
type CustomEnumFilter struct {
// ObjectType is the object type the enum applies to, e.g. "risk", "control", "risk_category"
ObjectType string
// Field is the field the enum applies to, e.g. "kind", "category"
Field string
// EdgeFieldName is the edge field name the enum applies to that is the foreign key, e.g. "risk_kind_id"
EdgeFieldName string
// SchemaFieldName is the schema field name the enum applies to, e.g. "control_kind_name
SchemaFieldName string
// AllowGlobal indicates the enum lookup should use global enums with an empty object type
AllowGlobal bool
// DisableAutoCreate disables auto-creation of the enum if it doesn't exist
DisableAutoCreate bool
}
CustomEnumFilter is used to filter custom enums based on object type and field
type FileBackupRequest ¶ added in v2.4.1
type FileBackupRequest struct {
FileID string `json:"file_id"`
}
FileBackupRequest asks for a single file to be replicated to its backup provider
type MutationMember ¶
type MutationMember interface {
utils.GenericMutation
UserIDs() []string
UserID() (string, bool)
}
MutationMember is an interface that can be implemented by a member mutation to get IDs
type MutationWithEmail ¶
type MutationWithEmail interface {
Email() (string, bool)
utils.GenericMutation
}
MutationWithEmail is an interface that mutations that require email validation must implement
type MutationWithRevision ¶
type MutationWithRevision interface {
Revision() (string, bool)
RevisionCleared() bool
OldRevision(ctx context.Context) (string, error)
SetRevision(s string)
OldField(ctx context.Context, name string) (ent.Value, error)
utils.GenericMutation
}
MutationWithRevision is an interface that defines the methods required for a mutation to be able to handle revisions It includes methods for getting and setting the revision
type OrgMember ¶
type OrgMember struct {
// UserID is the user ID of the org member
UserID string
// NewRole is the role of the org member
NewRole enums.Role
// OldRow is the old role of the org member
OldRole enums.Role
// OrgID is the organization ID of the org member
OrgID string
}
OrgMember is a struct to hold the org member details
type OrganizationAvatarListenerOption ¶
type OrganizationAvatarListenerOption func(*organizationAvatarListenerConfig)
OrganizationAvatarListenerOption customizes avatar discovery
func WithOrganizationAvatarRequester ¶
func WithOrganizationAvatarRequester(requester *httpsling.Requester) OrganizationAvatarListenerOption
WithOrganizationAvatarRequester sets the avatar discovery requester
type TaskLabelResolver ¶
TaskLabelResolver resolves a human-readable label for one EachElement value filling the {label} placeholder in a task template
Source Files
¶
- apitoken.go
- assessment.go
- assessment_response.go
- asset.go
- auth.go
- authzmutationhelpers.go
- avatar.go
- campaigntarget.go
- contact.go
- control.go
- controlimplementation.go
- custom_domain.go
- customenums.go
- directoryaccount.go
- dnsverification.go
- doc.go
- documentdata.go
- documentextract.go
- documents.go
- edges.go
- email.go
- email_config.go
- email_context_helpers.go
- emailtemplate.go
- emailverificationtoken.go
- entity.go
- errors.go
- event_hook.go
- evidence.go
- export.go
- file.go
- file_helpers.go
- filedownload.go
- group.go
- groupmembers.go
- groupvisibility.go
- helpers.go
- history_helpers.go
- identityholder.go
- impersonator.go
- integration.go
- invite.go
- listeners_campaign_recurring.go
- listeners_document_associations.go
- listeners_entitlements.go
- listeners_file_backup.go
- listeners_identityresolution.go
- listeners_integration_cleanup.go
- listeners_nda_attestation.go
- listeners_organization_avatar.go
- listeners_organization_cleanup.go
- listeners_questionnaire_transform.go
- listeners_registry.go
- listeners_scan_domain.go
- listeners_subscriber_link.go
- listeners_task_rules.go
- listeners_trustcenter_cache.go
- listeners_trustcenter_watermark.go
- listeners_vendorscoring.go
- listeners_workflow.go
- managedgroups.go
- mappedcontrol.go
- memberhelpers.go
- metrics.go
- nda_attestation.go
- note.go
- notification.go
- notificationtemplate.go
- objectownedtuples.go
- onboarding.go
- organization.go
- organizationsetting.go
- orgmembers.go
- orgmodule.go
- orgownedtuples.go
- orgsetting_sso.go
- passwordresettoken.go
- personalaccesstoken.go
- platform.go
- program.go
- programmembers.go
- register.go
- requestor.go
- review.go
- revision.go
- risks.go
- sessions.go
- severity.go
- slack_config.go
- slateJSON.go
- standard.go
- subcontrol.go
- subprocessor.go
- subscriber.go
- systemownededges.go
- tagdefinition.go
- tags.go
- task.go
- template.go
- tfasettings.go
- trustcenter.go
- trustcenter_compliance.go
- trustcenter_entity.go
- trustcenterdoc.go
- trustcenterfaq.go
- trustcenterndarequest.go
- trustcentersetting.go
- trustcentersubprocessor.go
- trustcenterwatermarkconfig.go
- tuples.go
- user.go
- usersettings.go
- usertuples.go
- vendorscoring.go
- webauthn.go
- wildcardtuples.go
- workflow_approval.go
- workflow_instance_cleanup.go
- workflowassignment.go
- workflowdefinition.go
- workflowproposal.go