@@ -69,7 +69,7 @@ func (e AccessEntry) CursorKey(orderBy AccessEntryOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (e *AccessEntry) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (e *AccessEntry) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM access_entries WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -85,7 +85,7 @@ func (e *AccessEntry) AuthorizationAttributes(ctx context.Context, conn pg.Conn)
|
||||
|
||||
func (e *AccessEntry) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -149,7 +149,7 @@ LIMIT 1;
|
||||
|
||||
func (e *AccessEntry) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -253,7 +253,7 @@ VALUES (
|
||||
|
||||
func (e *AccessEntry) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -298,7 +298,7 @@ WHERE
|
||||
|
||||
func (entries *AccessEntries) LoadByCampaignID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
cursor *page.Cursor[AccessEntryOrderField],
|
||||
@@ -364,7 +364,7 @@ WHERE
|
||||
|
||||
func (entries *AccessEntries) LoadByCampaignIDAndSourceID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
sourceID gid.GID,
|
||||
@@ -432,7 +432,7 @@ WHERE
|
||||
|
||||
func (entries *AccessEntries) CountByCampaignID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
filter *AccessEntryFilter,
|
||||
@@ -461,7 +461,7 @@ WHERE
|
||||
|
||||
func (entries *AccessEntries) CountByCampaignIDAndSourceID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
sourceID gid.GID,
|
||||
@@ -492,7 +492,7 @@ WHERE
|
||||
|
||||
func (entries *AccessEntries) CountPendingByCampaignID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -519,7 +519,7 @@ WHERE
|
||||
|
||||
func (e *AccessEntry) LoadOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
entryID gid.GID,
|
||||
) (gid.GID, error) {
|
||||
q := `SELECT organization_id FROM access_entries WHERE id = $1 LIMIT 1;`
|
||||
@@ -537,7 +537,7 @@ func (e *AccessEntry) LoadOrganizationID(
|
||||
|
||||
func (e *AccessEntry) UpdateFlags(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -574,7 +574,7 @@ WHERE
|
||||
|
||||
func (e *AccessEntry) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -698,7 +698,7 @@ type BaselineAccountEntry struct {
|
||||
|
||||
func (entries *AccessEntries) LoadBaselineBySourceID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
sourceID gid.GID,
|
||||
@@ -751,7 +751,7 @@ type MembershipAccount struct {
|
||||
|
||||
func LoadMembershipAccountsByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) ([]MembershipAccount, error) {
|
||||
|
||||
@@ -43,7 +43,7 @@ type (
|
||||
|
||||
func (h *AccessEntryDecisionHistory) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -91,7 +91,7 @@ INSERT INTO access_entry_decision_history (
|
||||
|
||||
func (h *AccessEntryDecisionHistory) AuthorizationAttributes(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM access_entry_decision_history WHERE id = $1 LIMIT 1;`
|
||||
|
||||
@@ -108,7 +108,7 @@ func (h *AccessEntryDecisionHistory) AuthorizationAttributes(
|
||||
|
||||
func (hs *AccessEntryDecisionHistories) LoadByEntryID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
entryID gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -33,7 +33,7 @@ type AccessEntryStatistics struct {
|
||||
|
||||
func (s *AccessEntryStatistics) LoadByCampaignID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
) error {
|
||||
@@ -135,7 +135,7 @@ GROUP BY incremental_tag;
|
||||
|
||||
func (s *AccessEntryStatistics) LoadByCampaignIDAndSourceID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
sourceID gid.GID,
|
||||
|
||||
@@ -53,7 +53,7 @@ func (c AccessReviewCampaign) CursorKey(orderBy AccessReviewCampaignOrderField)
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (c *AccessReviewCampaign) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (c *AccessReviewCampaign) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM access_review_campaigns WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -69,7 +69,7 @@ func (c *AccessReviewCampaign) AuthorizationAttributes(ctx context.Context, conn
|
||||
|
||||
func (c *AccessReviewCampaign) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -117,7 +117,7 @@ LIMIT 1;
|
||||
|
||||
func (c *AccessReviewCampaign) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -173,7 +173,7 @@ VALUES (
|
||||
|
||||
func (c *AccessReviewCampaign) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -218,7 +218,7 @@ WHERE
|
||||
|
||||
func (c *AccessReviewCampaign) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -244,7 +244,7 @@ WHERE %s AND id = @id
|
||||
|
||||
func (campaigns *AccessReviewCampaigns) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[AccessReviewCampaignOrderField],
|
||||
@@ -291,7 +291,7 @@ WHERE
|
||||
|
||||
func (campaigns *AccessReviewCampaigns) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -317,7 +317,7 @@ WHERE
|
||||
|
||||
func (c *AccessReviewCampaign) LoadLastCompletedByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -33,7 +33,7 @@ type AccessReviewCampaignScopeSystem struct {
|
||||
|
||||
func (ss AccessReviewCampaignScopeSystem) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -56,7 +56,7 @@ VALUES (@access_review_campaign_id, @access_source_id, @tenant_id)
|
||||
|
||||
func (ss AccessReviewCampaignScopeSystem) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -80,7 +80,7 @@ ON CONFLICT (access_review_campaign_id, access_source_id) DO NOTHING
|
||||
|
||||
func (ss AccessReviewCampaignScopeSystem) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -108,7 +108,7 @@ WHERE
|
||||
|
||||
func (c *AccessReviewCampaign) LockForUpdate(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -135,7 +135,7 @@ FOR UPDATE
|
||||
|
||||
func (f *AccessReviewCampaignSourceFetch) UpsertQueued(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
now time.Time,
|
||||
) error {
|
||||
@@ -184,7 +184,7 @@ ON CONFLICT (access_review_campaign_id, access_source_id) DO UPDATE SET
|
||||
// all stale fetches regardless of tenant.
|
||||
func (fs *AccessReviewCampaignSourceFetches) RecoverStale(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
staleThreshold time.Time,
|
||||
now time.Time,
|
||||
) (int64, error) {
|
||||
|
||||
@@ -54,7 +54,7 @@ var (
|
||||
|
||||
func (f *AccessReviewCampaignSourceFetch) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -107,7 +107,7 @@ INSERT INTO access_review_campaign_source_fetches (
|
||||
|
||||
func (f *AccessReviewCampaignSourceFetch) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -154,7 +154,7 @@ WHERE
|
||||
|
||||
func (f *AccessReviewCampaignSourceFetch) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
sourceID gid.GID,
|
||||
@@ -207,7 +207,7 @@ LIMIT 1
|
||||
|
||||
func (fs *AccessReviewCampaignSourceFetches) LoadByCampaignID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
) error {
|
||||
@@ -258,7 +258,7 @@ ORDER BY created_at ASC
|
||||
// Scope for subsequent operations.
|
||||
func (f *AccessReviewCampaignSourceFetch) LoadNextQueuedForUpdateSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
|
||||
@@ -52,7 +52,7 @@ func (as AccessSource) CursorKey(orderBy AccessSourceOrderField) page.CursorKey
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (as *AccessSource) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (as *AccessSource) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM access_sources WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -68,7 +68,7 @@ func (as *AccessSource) AuthorizationAttributes(ctx context.Context, conn pg.Con
|
||||
|
||||
func (as *AccessSource) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -115,7 +115,7 @@ LIMIT 1;
|
||||
|
||||
func (as *AccessSource) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -168,7 +168,7 @@ VALUES (
|
||||
|
||||
func (as *AccessSource) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -211,7 +211,7 @@ WHERE
|
||||
|
||||
func (as *AccessSource) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -237,7 +237,7 @@ WHERE %s AND id = @id
|
||||
|
||||
func (sources *AccessSources) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[AccessSourceOrderField],
|
||||
@@ -283,7 +283,7 @@ WHERE
|
||||
|
||||
func (sources *AccessSources) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -311,7 +311,7 @@ WHERE
|
||||
// name order. Only explicitly scoped sources are returned.
|
||||
func (sources *AccessSources) LoadScopeSourcesByCampaignID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
campaignID gid.GID,
|
||||
) error {
|
||||
@@ -366,7 +366,7 @@ var ErrNoAccessSourceNameSyncAvailable = fmt.Errorf("no access source name sync
|
||||
// FOR UPDATE SKIP LOCKED so concurrent workers do not pick the same row.
|
||||
func (as *AccessSource) LoadNextUnsyncedNameForUpdateSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
|
||||
@@ -58,7 +58,7 @@ func (s ApplicabilityStatement) CursorKey(orderBy ApplicabilityStatementOrderFie
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (s *ApplicabilityStatement) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (s *ApplicabilityStatement) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM applicability_statements WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -74,7 +74,7 @@ func (s *ApplicabilityStatement) AuthorizationAttributes(ctx context.Context, co
|
||||
|
||||
func (sac *ApplicabilityStatement) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -144,7 +144,7 @@ LIMIT 1;
|
||||
|
||||
func (sac *ApplicabilityStatement) LoadByStateOfApplicabilityIDAndControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
stateOfApplicabilityID gid.GID,
|
||||
controlID gid.GID,
|
||||
@@ -208,7 +208,7 @@ LIMIT 1;
|
||||
|
||||
func (sac *ApplicabilityStatement) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -269,7 +269,7 @@ VALUES (
|
||||
|
||||
func (sac *ApplicabilityStatement) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -304,7 +304,7 @@ WHERE
|
||||
|
||||
func (sac *ApplicabilityStatement) UpdateByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -341,7 +341,7 @@ WHERE
|
||||
|
||||
func (sac *ApplicabilityStatement) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -371,7 +371,7 @@ WHERE state_of_applicability_id IN (SELECT id FROM current_soa)
|
||||
|
||||
func (sac *ApplicabilityStatement) DeleteByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
applicabilityStatementID gid.GID,
|
||||
) error {
|
||||
@@ -400,7 +400,7 @@ WHERE
|
||||
|
||||
func (sacs *ApplicabilityStatements) LoadByStateOfApplicabilityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
stateOfApplicabilityID gid.GID,
|
||||
cursor *page.Cursor[ApplicabilityStatementOrderField],
|
||||
@@ -469,7 +469,7 @@ WHERE
|
||||
|
||||
func (sacs *ApplicabilityStatements) CountByStateOfApplicabilityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
stateOfApplicabilityID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -497,7 +497,7 @@ WHERE
|
||||
|
||||
func (sacs *ApplicabilityStatements) LoadByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
cursor *page.Cursor[ApplicabilityStatementOrderField],
|
||||
|
||||
@@ -57,7 +57,7 @@ func (a *Asset) CursorKey(field AssetOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (a *Asset) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (a *Asset) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM assets WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -73,7 +73,7 @@ func (a *Asset) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[
|
||||
|
||||
func (a *Asset) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
assetID gid.GID,
|
||||
) error {
|
||||
@@ -124,7 +124,7 @@ LIMIT 1;
|
||||
|
||||
func (a *Asset) LoadByOwnerID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -174,7 +174,7 @@ LIMIT 1;
|
||||
|
||||
func (a *Assets) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *AssetFilter,
|
||||
@@ -208,7 +208,7 @@ WHERE
|
||||
|
||||
func (a *Assets) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[AssetOrderField],
|
||||
@@ -260,7 +260,7 @@ WHERE
|
||||
|
||||
func (a *Asset) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -312,7 +312,7 @@ INSERT INTO assets (
|
||||
|
||||
func (a *Asset) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -372,7 +372,7 @@ RETURNING
|
||||
|
||||
func (a *Asset) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -396,7 +396,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (assets Assets) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
func (assets Assets) Snapshot(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
snapshotters := []AssetSnapshotter{Assets{}, Vendors{}, AssetVendors{}}
|
||||
|
||||
for _, snapshotter := range snapshotters {
|
||||
@@ -410,7 +410,7 @@ func (assets Assets) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, o
|
||||
|
||||
func (assets Assets) InsertAssetSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -37,13 +37,13 @@ type (
|
||||
AssetVendors []*AssetVendor
|
||||
|
||||
AssetSnapshotter interface {
|
||||
InsertAssetSnapshots(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
InsertAssetSnapshots(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
}
|
||||
)
|
||||
|
||||
func (av AssetVendors) Merge(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
assetID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -89,7 +89,7 @@ WHEN NOT MATCHED
|
||||
|
||||
func (av AssetVendors) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
assetID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -127,7 +127,7 @@ FROM vendor_ids
|
||||
|
||||
func (av AssetVendors) InsertAssetSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -61,7 +61,7 @@ func (a *Audit) CursorKey(field AuditOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (a *Audit) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (a *Audit) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM audits WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -77,7 +77,7 @@ func (a *Audit) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[
|
||||
|
||||
func (a *Audit) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
auditID gid.GID,
|
||||
) error {
|
||||
@@ -128,7 +128,7 @@ LIMIT 1;
|
||||
|
||||
func (a *Audits) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -160,7 +160,7 @@ WHERE
|
||||
|
||||
func (a *Audits) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[AuditOrderField],
|
||||
@@ -212,7 +212,7 @@ WHERE
|
||||
|
||||
func (a *Audits) LoadAllByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *AuditFilter,
|
||||
@@ -262,7 +262,7 @@ ORDER BY valid_from DESC
|
||||
|
||||
func (a *Audit) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -320,7 +320,7 @@ INSERT INTO audits (
|
||||
|
||||
func (a *Audit) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -362,7 +362,7 @@ WHERE
|
||||
|
||||
func (a *Audit) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -387,7 +387,7 @@ WHERE
|
||||
|
||||
func (a *Audits) LoadByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
cursor *page.Cursor[AuditOrderField],
|
||||
@@ -454,7 +454,7 @@ WHERE %s
|
||||
|
||||
func (a *Audits) LoadByFindingID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
findingID gid.GID,
|
||||
cursor *page.Cursor[AuditOrderField],
|
||||
@@ -521,7 +521,7 @@ WHERE %s
|
||||
|
||||
func (a *Audits) CountByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -563,7 +563,7 @@ WHERE
|
||||
|
||||
func (a *Audits) CountByFindingID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
findingID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -605,7 +605,7 @@ WHERE
|
||||
|
||||
func (a *Audit) LoadByReportID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
reportID gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -53,7 +53,7 @@ func (e AuditLogEntry) CursorKey(orderBy AuditLogEntryOrderField) page.CursorKey
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (e *AuditLogEntry) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (e *AuditLogEntry) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM audit_log_entries WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -69,7 +69,7 @@ func (e *AuditLogEntry) AuthorizationAttributes(ctx context.Context, conn pg.Con
|
||||
|
||||
func (e *AuditLogEntry) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -122,7 +122,7 @@ VALUES (
|
||||
|
||||
func (e *AuditLogEntry) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -168,7 +168,7 @@ LIMIT 1;
|
||||
|
||||
func (es *AuditLogEntries) LoadAllByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[AuditLogEntryOrderField],
|
||||
@@ -216,7 +216,7 @@ WHERE
|
||||
|
||||
func (es *AuditLogEntries) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *AuditLogEntryFilter,
|
||||
|
||||
@@ -39,7 +39,7 @@ type (
|
||||
CachedCertificates []*CachedCertificate
|
||||
)
|
||||
|
||||
func (cc *CachedCertificate) LoadByDomain(ctx context.Context, conn pg.Conn, domain string) error {
|
||||
func (cc *CachedCertificate) LoadByDomain(ctx context.Context, conn pg.Querier, domain string) error {
|
||||
q := `
|
||||
SELECT
|
||||
domain,
|
||||
@@ -72,7 +72,7 @@ LIMIT 1
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cc *CachedCertificate) Upsert(ctx context.Context, conn pg.Conn) error {
|
||||
func (cc *CachedCertificate) Upsert(ctx context.Context, conn pg.Querier) error {
|
||||
cc.CachedAt = time.Now()
|
||||
|
||||
q := `
|
||||
@@ -120,7 +120,7 @@ ON CONFLICT (domain) DO UPDATE SET
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cc *CachedCertificate) Delete(ctx context.Context, conn pg.Conn, domain string) error {
|
||||
func (cc *CachedCertificate) Delete(ctx context.Context, conn pg.Tx, domain string) error {
|
||||
q := `DELETE FROM cached_certificates WHERE domain = @domain`
|
||||
args := pgx.NamedArgs{"domain": domain}
|
||||
|
||||
@@ -132,7 +132,7 @@ func (cc *CachedCertificate) Delete(ctx context.Context, conn pg.Conn, domain st
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cc *CachedCertificates) CountAll(ctx context.Context, conn pg.Conn) (int, error) {
|
||||
func (cc *CachedCertificates) CountAll(ctx context.Context, conn pg.Querier) (int, error) {
|
||||
q := `SELECT COUNT(*) FROM cached_certificates`
|
||||
|
||||
var count int
|
||||
@@ -144,7 +144,7 @@ func (cc *CachedCertificates) CountAll(ctx context.Context, conn pg.Conn) (int,
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (cc *CachedCertificates) CleanExpired(ctx context.Context, conn pg.Conn) error {
|
||||
func (cc *CachedCertificates) CleanExpired(ctx context.Context, conn pg.Querier) error {
|
||||
q := `
|
||||
DELETE
|
||||
FROM
|
||||
@@ -161,7 +161,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cc *CachedCertificate) RefreshFromDomain(ctx context.Context, conn pg.Conn, domain *CustomDomain, encryptionKey cipher.EncryptionKey) error {
|
||||
func (cc *CachedCertificate) RefreshFromDomain(ctx context.Context, conn pg.Querier, domain *CustomDomain, encryptionKey cipher.EncryptionKey) error {
|
||||
if domain.SSLCertificate == nil {
|
||||
return fmt.Errorf("domain has no parsed certificate")
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func (c ComplianceExternalURL) CursorKey(orderBy ComplianceExternalURLOrderField
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (c *ComplianceExternalURL) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (c *ComplianceExternalURL) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM compliance_external_urls WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -68,7 +68,7 @@ func (c *ComplianceExternalURL) AuthorizationAttributes(ctx context.Context, con
|
||||
|
||||
func (c *ComplianceExternalURL) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -114,7 +114,7 @@ LIMIT 1;
|
||||
|
||||
func (c *ComplianceExternalURL) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -164,7 +164,7 @@ RETURNING rank;
|
||||
|
||||
func (c *ComplianceExternalURL) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -197,7 +197,7 @@ WHERE
|
||||
|
||||
func (c *ComplianceExternalURL) UpdateRank(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -248,7 +248,7 @@ WHERE %s
|
||||
|
||||
func (c *ComplianceExternalURL) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -273,7 +273,7 @@ WHERE
|
||||
|
||||
func (c *ComplianceExternalURLs) LoadByTrustCenterID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterID gid.GID,
|
||||
cursor *page.Cursor[ComplianceExternalURLOrderField],
|
||||
|
||||
@@ -55,7 +55,7 @@ func (c ComplianceFramework) CursorKey(orderBy ComplianceFrameworkOrderField) pa
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (c *ComplianceFramework) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (c *ComplianceFramework) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM compliance_frameworks WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -71,7 +71,7 @@ func (c *ComplianceFramework) AuthorizationAttributes(ctx context.Context, conn
|
||||
|
||||
func (c *ComplianceFramework) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
complianceFrameworkID gid.GID,
|
||||
) error {
|
||||
@@ -117,7 +117,7 @@ LIMIT 1;
|
||||
|
||||
func (c *ComplianceFramework) LoadByTrustCenterIDAndFrameworkID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterID gid.GID,
|
||||
frameworkID gid.GID,
|
||||
@@ -168,7 +168,7 @@ LIMIT 1;
|
||||
|
||||
func (c *ComplianceFramework) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -222,7 +222,7 @@ RETURNING rank;
|
||||
|
||||
func (c *ComplianceFramework) UpdateRank(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -272,7 +272,7 @@ WHERE %s
|
||||
|
||||
func (c *ComplianceFramework) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -297,7 +297,7 @@ WHERE
|
||||
|
||||
func (c *ComplianceFrameworks) LoadByTrustCenterID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterID gid.GID,
|
||||
cursor *page.Cursor[ComplianceFrameworkOrderField],
|
||||
@@ -342,7 +342,7 @@ WHERE
|
||||
|
||||
func (c *ComplianceFrameworks) LoadWithHiddenByTrustCenterID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterID gid.GID,
|
||||
cursor *page.Cursor[ComplianceFrameworkOrderField],
|
||||
|
||||
@@ -82,7 +82,7 @@ func (c *Connector) CursorKey(orderBy ConnectorOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (c *Connector) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (c *Connector) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM connectors WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -98,7 +98,7 @@ func (c *Connector) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (
|
||||
|
||||
func (c *Connectors) LoadAllByOrganizationIDProtocolAndProvider(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
protocol ConnectorProtocol,
|
||||
@@ -118,7 +118,7 @@ func (c *Connectors) LoadAllByOrganizationIDProtocolAndProvider(
|
||||
|
||||
func (c *Connectors) LoadByOrganizationIDWithoutDecryptedConnection(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[ConnectorOrderField],
|
||||
@@ -129,7 +129,7 @@ func (c *Connectors) LoadByOrganizationIDWithoutDecryptedConnection(
|
||||
|
||||
func (c *Connectors) LoadAllByOrganizationIDWithoutDecryptedConnection(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -138,7 +138,7 @@ func (c *Connectors) LoadAllByOrganizationIDWithoutDecryptedConnection(
|
||||
|
||||
func (c *Connector) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
connectorID gid.GID,
|
||||
encryptionKey cipher.EncryptionKey,
|
||||
@@ -175,7 +175,7 @@ func (c *Connector) LoadByID(
|
||||
// Use this when you only need provider, organization, or other metadata.
|
||||
func (c *Connector) LoadMetadataByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
connectorID gid.GID,
|
||||
) error {
|
||||
@@ -222,7 +222,7 @@ LIMIT 1;
|
||||
|
||||
func (c *Connector) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -248,7 +248,7 @@ WHERE %s AND id = @id
|
||||
|
||||
func (c *Connector) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
encryptionKey cipher.EncryptionKey,
|
||||
) error {
|
||||
@@ -328,7 +328,7 @@ INSERT INTO connectors (
|
||||
|
||||
func (c *Connectors) loadByOrganizationIDWithPagination(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[ConnectorOrderField],
|
||||
@@ -377,7 +377,7 @@ WHERE
|
||||
|
||||
func (c *Connectors) loadAllByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -422,7 +422,7 @@ ORDER BY
|
||||
|
||||
func (c *Connectors) loadAllByOrganizationIDProtocolAndProvider(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
protocol ConnectorProtocol,
|
||||
@@ -475,7 +475,7 @@ ORDER BY
|
||||
|
||||
func (c *Connector) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
encryptionKey cipher.EncryptionKey,
|
||||
) error {
|
||||
|
||||
@@ -58,7 +58,7 @@ func (c Control) CursorKey(orderBy ControlOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (c *Control) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (c *Control) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM controls WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -74,7 +74,7 @@ func (c *Control) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (ma
|
||||
|
||||
func (c *Controls) CountByDocumentID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
filter *ControlFilter,
|
||||
@@ -116,7 +116,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) LoadByDocumentID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
cursor *page.Cursor[ControlOrderField],
|
||||
@@ -187,7 +187,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) CountByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
filter *ControlFilter,
|
||||
@@ -229,7 +229,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) LoadByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
cursor *page.Cursor[ControlOrderField],
|
||||
@@ -300,7 +300,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) CountByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
filter *ControlFilter,
|
||||
@@ -348,7 +348,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) LoadByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
cursor *page.Cursor[ControlOrderField],
|
||||
@@ -425,7 +425,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) CountByFrameworkID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
frameworkID gid.GID,
|
||||
filter *ControlFilter,
|
||||
@@ -457,7 +457,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) LoadByFrameworkID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
frameworkID gid.GID,
|
||||
cursor *page.Cursor[ControlOrderField],
|
||||
@@ -508,7 +508,7 @@ WHERE
|
||||
|
||||
func (c *Controls) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *ControlFilter,
|
||||
@@ -551,7 +551,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[ControlOrderField],
|
||||
@@ -622,7 +622,7 @@ WHERE %s
|
||||
|
||||
func (c *Control) LoadByFrameworkIDAndSectionTitle(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
frameworkID gid.GID,
|
||||
sectionTitle string,
|
||||
@@ -673,7 +673,7 @@ LIMIT 1;
|
||||
|
||||
func (c *Control) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
) error {
|
||||
@@ -722,7 +722,7 @@ LIMIT 1;
|
||||
|
||||
func (c *Controls) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlIDs []gid.GID,
|
||||
) error {
|
||||
@@ -767,7 +767,7 @@ WHERE
|
||||
|
||||
func (c Control) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -833,7 +833,7 @@ VALUES (
|
||||
|
||||
func (c Control) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -855,7 +855,7 @@ WHERE
|
||||
|
||||
func (c *Control) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -901,7 +901,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) LoadByAuditID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
auditID gid.GID,
|
||||
cursor *page.Cursor[ControlOrderField],
|
||||
@@ -972,7 +972,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) LoadBySnapshotID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
snapshotID gid.GID,
|
||||
cursor *page.Cursor[ControlOrderField],
|
||||
@@ -1043,7 +1043,7 @@ WHERE %s
|
||||
|
||||
func (c *Controls) CountByStateOfApplicabilityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
stateOfApplicabilityID gid.GID,
|
||||
filter *ControlFilter,
|
||||
|
||||
@@ -38,7 +38,7 @@ type (
|
||||
|
||||
func (ca ControlAudit) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -73,7 +73,7 @@ ON CONFLICT (control_id, audit_id) DO NOTHING;
|
||||
|
||||
func (ca ControlAudit) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
auditID gid.GID,
|
||||
|
||||
@@ -41,7 +41,7 @@ type (
|
||||
|
||||
func (cp ControlDocument) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -87,7 +87,7 @@ VALUES (
|
||||
|
||||
func (cp ControlDocument) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
documentID gid.GID,
|
||||
@@ -116,7 +116,7 @@ WHERE
|
||||
|
||||
func (cp ControlDocument) DeleteByDocumentIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
documentIDs []gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -39,7 +39,7 @@ type (
|
||||
|
||||
func (cm ControlMeasure) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -74,7 +74,7 @@ ON CONFLICT (control_id, measure_id) DO NOTHING;
|
||||
|
||||
func (cm ControlMeasure) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
measureID gid.GID,
|
||||
@@ -108,7 +108,7 @@ type ControlsWithRisk []*ControlWithRisk
|
||||
|
||||
func (cwrs *ControlsWithRisk) LoadByControlIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlIDs []gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -37,7 +37,7 @@ type (
|
||||
|
||||
func (co ControlObligation) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -69,7 +69,7 @@ ON CONFLICT (control_id, obligation_id) DO NOTHING;
|
||||
|
||||
func (co ControlObligation) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
obligationID gid.GID,
|
||||
@@ -97,7 +97,7 @@ WHERE
|
||||
|
||||
func (cos *ControlObligations) CountByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
filter *ControlObligationFilter,
|
||||
|
||||
@@ -38,7 +38,7 @@ type (
|
||||
|
||||
func (cs ControlSnapshot) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -73,7 +73,7 @@ ON CONFLICT (control_id, snapshot_id) DO NOTHING;
|
||||
|
||||
func (cs ControlSnapshot) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -66,7 +66,7 @@ func NewCustomDomain(tenantID gid.TenantID, domain string) *CustomDomain {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (cd *CustomDomain) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (cd *CustomDomain) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM custom_domains WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -151,7 +151,7 @@ func (cd *CustomDomain) ParseCertificate(encryptionKey cipher.EncryptionKey) err
|
||||
|
||||
func (cd *CustomDomain) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
domainID gid.GID,
|
||||
) error {
|
||||
@@ -207,7 +207,7 @@ LIMIT 1
|
||||
|
||||
func (cd *CustomDomain) LoadByIDForUpdateSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
domainID gid.GID,
|
||||
) error {
|
||||
@@ -263,7 +263,7 @@ FOR UPDATE SKIP LOCKED
|
||||
|
||||
func (cd *CustomDomain) LoadByDomain(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
domain string,
|
||||
) error {
|
||||
@@ -319,7 +319,7 @@ LIMIT 1
|
||||
|
||||
func (cd *CustomDomain) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -375,7 +375,7 @@ LIMIT 1
|
||||
|
||||
func (cd *CustomDomain) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
encryptionKey cipher.EncryptionKey,
|
||||
) error {
|
||||
@@ -462,7 +462,7 @@ INSERT INTO custom_domains (
|
||||
|
||||
func (cd *CustomDomain) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
var encryptedKey []byte
|
||||
@@ -522,7 +522,7 @@ WHERE
|
||||
|
||||
func (cd *CustomDomain) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -547,7 +547,7 @@ WHERE
|
||||
|
||||
func (cd *CustomDomain) LoadByHTTPChallengeToken(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
token string,
|
||||
) error {
|
||||
@@ -599,7 +599,7 @@ LIMIT 1
|
||||
|
||||
func (domains *CustomDomains) ListDomainsForRenewal(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -651,7 +651,7 @@ ORDER BY
|
||||
|
||||
func (domains *CustomDomains) ListDomainsWithPendingHTTPChallenges(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -706,7 +706,7 @@ WHERE
|
||||
|
||||
func (domains *CustomDomains) LoadActiveCertificates(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -756,7 +756,7 @@ WHERE
|
||||
|
||||
func (domains *CustomDomains) ListStaleProvisioningDomains(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -57,7 +57,7 @@ func (dpia *DataProtectionImpactAssessment) CursorKey(field DataProtectionImpact
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (dpia *DataProtectionImpactAssessment) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (dpia *DataProtectionImpactAssessment) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM processing_activity_data_protection_impact_assessments WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -73,7 +73,7 @@ func (dpia *DataProtectionImpactAssessment) AuthorizationAttributes(ctx context.
|
||||
|
||||
func (dpias *DataProtectionImpactAssessments) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *DataProtectionImpactAssessmentFilter,
|
||||
@@ -108,7 +108,7 @@ WHERE
|
||||
|
||||
func (dpias *DataProtectionImpactAssessments) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[DataProtectionImpactAssessmentOrderField],
|
||||
@@ -161,7 +161,7 @@ WHERE
|
||||
|
||||
func (dpias *DataProtectionImpactAssessments) LoadAllByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *DataProtectionImpactAssessmentFilter,
|
||||
@@ -211,7 +211,7 @@ WHERE
|
||||
|
||||
func (dpia *DataProtectionImpactAssessment) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
dpiaID gid.GID,
|
||||
) error {
|
||||
@@ -263,7 +263,7 @@ LIMIT 1;
|
||||
|
||||
func (dpia *DataProtectionImpactAssessment) LoadByProcessingActivityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
processingActivityID gid.GID,
|
||||
) error {
|
||||
@@ -315,7 +315,7 @@ LIMIT 1;
|
||||
|
||||
func (dpia *DataProtectionImpactAssessment) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -377,7 +377,7 @@ INSERT INTO processing_activity_data_protection_impact_assessments (
|
||||
|
||||
func (dpia *DataProtectionImpactAssessment) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -416,7 +416,7 @@ WHERE
|
||||
|
||||
func (dpia *DataProtectionImpactAssessment) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -441,7 +441,7 @@ WHERE
|
||||
|
||||
func (dpias DataProtectionImpactAssessments) InsertProcessingActivitySnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -43,7 +43,7 @@ type (
|
||||
Data []*Datum
|
||||
|
||||
DataSnapshotter interface {
|
||||
InsertDataSnapshots(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
InsertDataSnapshots(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
}
|
||||
)
|
||||
|
||||
@@ -61,7 +61,7 @@ func (d *Datum) CursorKey(field DatumOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (d *Datum) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (d *Datum) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM data WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -77,7 +77,7 @@ func (d *Datum) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[
|
||||
|
||||
func (d *Datum) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
dataID gid.GID,
|
||||
) error {
|
||||
@@ -122,7 +122,7 @@ LIMIT 1;
|
||||
|
||||
func (d *Datum) LoadByOwnerID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -166,7 +166,7 @@ LIMIT 1;
|
||||
|
||||
func (d *Data) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *DatumFilter,
|
||||
@@ -201,7 +201,7 @@ WHERE
|
||||
|
||||
func (d *Data) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[DatumOrderField],
|
||||
@@ -251,7 +251,7 @@ WHERE
|
||||
|
||||
func (d *Datum) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -303,7 +303,7 @@ INSERT INTO data (
|
||||
|
||||
func (d *Datum) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -357,7 +357,7 @@ RETURNING
|
||||
|
||||
func (d *Datum) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -381,7 +381,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d Data) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
func (d Data) Snapshot(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
snapshotters := []DataSnapshotter{Data{}, Vendors{}, DatumVendors{}}
|
||||
|
||||
for _, snapshotter := range snapshotters {
|
||||
@@ -395,7 +395,7 @@ func (d Data) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organiza
|
||||
|
||||
func (d Data) InsertDataSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -38,7 +38,7 @@ type (
|
||||
|
||||
func (dv DatumVendors) Merge(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
datumID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -84,7 +84,7 @@ WHEN NOT MATCHED BY SOURCE
|
||||
|
||||
func (dv DatumVendors) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
datumID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -122,7 +122,7 @@ FROM vendor_ids
|
||||
|
||||
func (d DatumVendors) InsertDataSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -62,7 +62,7 @@ func (p Document) CursorKey(orderBy DocumentOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (d *Document) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (d *Document) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `
|
||||
WITH document AS (
|
||||
SELECT id, organization_id, status
|
||||
@@ -119,7 +119,7 @@ LEFT JOIN last_quorum lq ON lq.document_id = document.id;
|
||||
|
||||
func (p *Document) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
) error {
|
||||
@@ -177,7 +177,7 @@ LIMIT 1;
|
||||
|
||||
func (p *Document) LoadByIDWithFilter(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
filter *DocumentFilter,
|
||||
@@ -238,7 +238,7 @@ LIMIT 1;
|
||||
|
||||
func (p *Documents) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentIDs []gid.GID,
|
||||
) error {
|
||||
@@ -291,7 +291,7 @@ WHERE
|
||||
|
||||
func (p *Documents) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *DocumentFilter,
|
||||
@@ -325,7 +325,7 @@ WHERE
|
||||
|
||||
func (p *Documents) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[DocumentOrderField],
|
||||
@@ -384,7 +384,7 @@ WHERE
|
||||
|
||||
func (p *Documents) LoadAllByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *DocumentFilter,
|
||||
@@ -441,7 +441,7 @@ ORDER BY title ASC
|
||||
|
||||
func (p *Documents) LoadPublishedByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[DocumentOrderField],
|
||||
@@ -511,7 +511,7 @@ WHERE
|
||||
|
||||
func (p Document) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -563,7 +563,7 @@ VALUES (
|
||||
|
||||
func (p Document) SoftDelete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -581,7 +581,7 @@ UPDATE documents SET deleted_at = @deleted_at WHERE %s AND id = @document_id
|
||||
|
||||
func (p Document) DeleteByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -600,7 +600,7 @@ DELETE FROM documents WHERE %s AND organization_id = @organization_id
|
||||
|
||||
func (p *Document) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -643,7 +643,7 @@ WHERE
|
||||
|
||||
func (p *Documents) CountByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
filter *DocumentFilter,
|
||||
@@ -679,7 +679,7 @@ WHERE cp.control_id = @control_id
|
||||
|
||||
func (p *Documents) LoadByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
cursor *page.Cursor[DocumentOrderField],
|
||||
@@ -740,7 +740,7 @@ WHERE cp.control_id = @control_id
|
||||
|
||||
func (p *Documents) CountByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
filter *DocumentFilter,
|
||||
@@ -776,7 +776,7 @@ WHERE rp.risk_id = @risk_id
|
||||
|
||||
func (p *Documents) LoadByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
cursor *page.Cursor[DocumentOrderField],
|
||||
@@ -837,7 +837,7 @@ WHERE rp.risk_id = @risk_id
|
||||
|
||||
func (p *Documents) BulkSoftDelete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -861,7 +861,7 @@ UPDATE documents SET deleted_at = @deleted_at WHERE %s AND id = ANY(@document_id
|
||||
|
||||
func (p *Documents) BulkArchive(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -888,7 +888,7 @@ UPDATE documents SET status = 'ARCHIVED', archived_at = @archived_at, trust_cent
|
||||
|
||||
func (p *Documents) BulkUnarchive(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -914,7 +914,7 @@ UPDATE documents SET status = 'ACTIVE', archived_at = NULL WHERE %s AND id = ANY
|
||||
|
||||
func (p *Document) IsLastSignableVersionSignedByUserEmail(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
userEmail mail.Addr,
|
||||
@@ -975,7 +975,7 @@ SELECT EXISTS (
|
||||
|
||||
func (p *Document) GetViewerApprovalStateForLastVersion(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
identityID gid.GID,
|
||||
|
||||
@@ -50,7 +50,7 @@ type (
|
||||
)
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (dv *DocumentVersion) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (dv *DocumentVersion) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `
|
||||
WITH document_version AS (
|
||||
SELECT id, document_id, organization_id, status AS version_status
|
||||
@@ -106,7 +106,7 @@ LEFT JOIN last_quorum lq ON lq.version_id = document_version.id;
|
||||
|
||||
func (dv *DocumentVersions) LoadByDocumentID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
cursor *page.Cursor[DocumentVersionOrderField],
|
||||
@@ -171,7 +171,7 @@ func (dv DocumentVersion) CursorKey(orderBy DocumentVersionOrderField) page.Curs
|
||||
|
||||
func (dv *DocumentVersion) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
) error {
|
||||
@@ -223,7 +223,7 @@ LIMIT 1;
|
||||
|
||||
func (dv DocumentVersion) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -295,7 +295,7 @@ VALUES (
|
||||
|
||||
func (dv *DocumentVersion) LoadByDocumentIDAndVersion(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
major int,
|
||||
@@ -353,7 +353,7 @@ LIMIT 1;
|
||||
|
||||
func (dv *DocumentVersion) LoadLatestVersion(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
) error {
|
||||
@@ -405,7 +405,7 @@ LIMIT 1;
|
||||
|
||||
func (dv *DocumentVersion) LoadLatestPublishedVersion(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
) error {
|
||||
@@ -459,7 +459,7 @@ LIMIT 1;
|
||||
|
||||
func (dv DocumentVersion) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -505,7 +505,7 @@ WHERE %s
|
||||
|
||||
func (dv DocumentVersion) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -531,7 +531,7 @@ WHERE %s
|
||||
|
||||
func (dv *DocumentVersions) CountByDocumentID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
filter *DocumentVersionFilter,
|
||||
|
||||
@@ -54,7 +54,7 @@ func (d DocumentVersionApprovalDecision) CursorKey(orderBy DocumentVersionApprov
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (d *DocumentVersionApprovalDecision) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (d *DocumentVersionApprovalDecision) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM document_version_approval_decisions WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -70,7 +70,7 @@ func (d *DocumentVersionApprovalDecision) AuthorizationAttributes(ctx context.Co
|
||||
|
||||
func (d *DocumentVersionApprovalDecision) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -118,7 +118,7 @@ WHERE
|
||||
|
||||
func (d *DocumentVersionApprovalDecision) LoadByQuorumIDAndApproverID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
quorumID gid.GID,
|
||||
approverID gid.GID,
|
||||
@@ -172,7 +172,7 @@ LIMIT 1
|
||||
|
||||
func (d *DocumentVersionApprovalDecisions) CountApprovedByQuorumID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
quorumID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -203,7 +203,7 @@ WHERE
|
||||
|
||||
func (d *DocumentVersionApprovalDecisions) LoadByQuorumID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
quorumID gid.GID,
|
||||
cursor *page.Cursor[DocumentVersionApprovalDecisionOrderField],
|
||||
@@ -254,7 +254,7 @@ WHERE
|
||||
|
||||
func (d *DocumentVersionApprovalDecision) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -315,7 +315,7 @@ INSERT INTO document_version_approval_decisions (
|
||||
|
||||
func (ds DocumentVersionApprovalDecisions) BulkInsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
if len(ds) == 0 {
|
||||
@@ -362,7 +362,7 @@ func (ds DocumentVersionApprovalDecisions) BulkInsert(
|
||||
|
||||
func (d *DocumentVersionApprovalDecision) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -401,7 +401,7 @@ WHERE
|
||||
|
||||
func (d *DocumentVersionApprovalDecision) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -426,7 +426,7 @@ WHERE
|
||||
|
||||
func (d *DocumentVersionApprovalDecisions) CountByQuorumID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
quorumID gid.GID,
|
||||
filter *DocumentVersionApprovalDecisionFilter,
|
||||
|
||||
@@ -50,7 +50,7 @@ func (q DocumentVersionApprovalQuorum) CursorKey(orderBy DocumentVersionApproval
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (q *DocumentVersionApprovalQuorum) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (q *DocumentVersionApprovalQuorum) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
query := `SELECT organization_id FROM document_version_approval_quorums WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -66,7 +66,7 @@ func (q *DocumentVersionApprovalQuorum) AuthorizationAttributes(ctx context.Cont
|
||||
|
||||
func (q *DocumentVersionApprovalQuorum) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -110,7 +110,7 @@ WHERE
|
||||
|
||||
func (q *DocumentVersionApprovalQuorum) LoadLastByDocumentVersionID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
) error {
|
||||
@@ -163,7 +163,7 @@ LIMIT 1
|
||||
|
||||
func (q *DocumentVersionApprovalQuorums) LoadAllByDocumentVersionID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
cursor *page.Cursor[DocumentVersionApprovalQuorumOrderField],
|
||||
@@ -214,7 +214,7 @@ WHERE
|
||||
|
||||
func (q *DocumentVersionApprovalQuorums) CountByDocumentVersionID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -251,7 +251,7 @@ WHERE
|
||||
|
||||
func (q *DocumentVersionApprovalQuorum) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
query := `
|
||||
@@ -300,7 +300,7 @@ INSERT INTO document_version_approval_quorums (
|
||||
|
||||
func (q *DocumentVersionApprovalQuorum) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
query := `
|
||||
@@ -325,7 +325,7 @@ WHERE
|
||||
|
||||
func (q *DocumentVersionApprovalQuorum) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
query := `
|
||||
|
||||
@@ -64,7 +64,7 @@ func (pvs DocumentVersionSignature) CursorKey(orderBy DocumentVersionSignatureOr
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (dvs *DocumentVersionSignature) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (dvs *DocumentVersionSignature) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM document_version_signatures WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -80,7 +80,7 @@ func (dvs *DocumentVersionSignature) AuthorizationAttributes(ctx context.Context
|
||||
|
||||
func (pvs *DocumentVersionSignature) LoadByDocumentVersionIDAndSignatory(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
signatory gid.GID,
|
||||
@@ -127,7 +127,7 @@ LIMIT 1
|
||||
|
||||
func (pvs *DocumentVersionSignature) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
signatureID gid.GID,
|
||||
) error {
|
||||
@@ -171,7 +171,7 @@ WHERE
|
||||
|
||||
func (pvs DocumentVersionSignature) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -229,7 +229,7 @@ INSERT INTO document_version_signatures (
|
||||
|
||||
func (pvss *DocumentVersionSignatures) LoadByDocumentVersionID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
cursor *page.Cursor[DocumentVersionSignatureOrderField],
|
||||
@@ -286,7 +286,7 @@ WHERE
|
||||
|
||||
func (pvs *DocumentVersionSignature) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -323,7 +323,7 @@ WHERE
|
||||
|
||||
func (pvs *DocumentVersionSignature) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
documentVersionSignatureID gid.GID,
|
||||
) error {
|
||||
@@ -349,7 +349,7 @@ WHERE
|
||||
|
||||
func (pvss *DocumentVersionSignaturesWithPeople) LoadByDocumentVersionIDWithPeople(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
limit int,
|
||||
@@ -424,7 +424,7 @@ LIMIT @limit
|
||||
|
||||
func (pvs *DocumentVersionSignature) IsSignedByUserEmail(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
userEmail mail.Addr,
|
||||
@@ -476,7 +476,7 @@ SELECT EXISTS (
|
||||
|
||||
func (dvs *DocumentVersionSignatures) CountByDocumentVersionID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
filter *DocumentVersionSignatureFilter,
|
||||
|
||||
@@ -79,7 +79,7 @@ func (es *ElectronicSignature) NewEvent(
|
||||
|
||||
func (es *ElectronicSignature) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -120,7 +120,7 @@ INSERT INTO electronic_signatures (
|
||||
|
||||
func (es *ElectronicSignature) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -180,7 +180,7 @@ WHERE
|
||||
|
||||
func (es *ElectronicSignature) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -220,7 +220,7 @@ LIMIT 1
|
||||
|
||||
func (es *ElectronicSignature) LoadNextAcceptedForUpdateSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
@@ -256,7 +256,7 @@ FOR UPDATE SKIP LOCKED
|
||||
|
||||
func (es *ElectronicSignature) LoadNextCompletedWithoutCertificateForUpdate(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
@@ -295,7 +295,7 @@ FOR UPDATE SKIP LOCKED
|
||||
|
||||
func ResetStaleProcessingSignatures(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
staleAfter time.Duration,
|
||||
) error {
|
||||
q := `
|
||||
@@ -355,7 +355,7 @@ func (es *ElectronicSignature) computeSealV1() (string, error) {
|
||||
|
||||
func ResetStaleCertificateProcessing(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
staleAfter time.Duration,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -44,7 +44,7 @@ type (
|
||||
|
||||
func (e *ElectronicSignatureEvent) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -81,7 +81,7 @@ INSERT INTO electronic_signature_events (
|
||||
|
||||
func (es *ElectronicSignatureEvents) LoadBySignatureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
sigID gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -65,7 +65,7 @@ var (
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
// Email is identity-scoped (not org-scoped), so it returns an empty map.
|
||||
func (e *Email) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (e *Email) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
return map[string]string{}, nil
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ func NewEmail(
|
||||
|
||||
func (e *Email) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
INSERT INTO emails (
|
||||
@@ -167,7 +167,7 @@ VALUES (
|
||||
|
||||
func (emails Emails) BulkInsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
) error {
|
||||
if len(emails) == 0 {
|
||||
return nil
|
||||
@@ -202,7 +202,7 @@ func (emails Emails) BulkInsert(
|
||||
|
||||
func (e *Email) LoadNextPendingForUpdateSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
@@ -237,7 +237,7 @@ FOR UPDATE SKIP LOCKED
|
||||
|
||||
func (e *Email) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
UPDATE emails
|
||||
@@ -269,7 +269,7 @@ WHERE id = @id
|
||||
|
||||
func ResetStaleProcessingEmails(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
staleAfter time.Duration,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewEmailAttachment(emailID, fileID gid.GID, filename string) *EmailAttachme
|
||||
|
||||
func (a *EmailAttachment) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
INSERT INTO email_attachments (id, email_id, file_id, filename, created_at)
|
||||
@@ -72,7 +72,7 @@ VALUES (@id, @email_id, @file_id, @filename, @created_at)
|
||||
|
||||
func (a *EmailAttachments) LoadByEmailID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
emailID gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -59,7 +59,7 @@ func (e Evidence) CursorKey(orderBy EvidenceOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (e *Evidence) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (e *Evidence) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM evidences WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -75,7 +75,7 @@ func (e *Evidence) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (m
|
||||
|
||||
func (e Evidence) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -141,7 +141,7 @@ WHERE evidences.state = 'REQUESTED';
|
||||
|
||||
func (e Evidence) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -216,7 +216,7 @@ VALUES (
|
||||
|
||||
func (e *Evidence) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
evidenceID gid.GID,
|
||||
) error {
|
||||
@@ -266,7 +266,7 @@ LIMIT 1;
|
||||
|
||||
func (e *Evidences) CountByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -298,7 +298,7 @@ WHERE
|
||||
|
||||
func (e *Evidences) LoadByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
cursor *page.Cursor[EvidenceOrderField],
|
||||
@@ -350,7 +350,7 @@ WHERE
|
||||
|
||||
func (e *Evidences) CountByTaskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
taskID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -382,7 +382,7 @@ WHERE
|
||||
|
||||
func (e *Evidences) LoadByTaskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
taskID gid.GID,
|
||||
cursor *page.Cursor[EvidenceOrderField],
|
||||
@@ -434,7 +434,7 @@ WHERE
|
||||
|
||||
func (e Evidence) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -475,7 +475,7 @@ WHERE
|
||||
|
||||
func (e Evidence) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -501,7 +501,7 @@ WHERE
|
||||
|
||||
func (e *Evidence) LoadNextPendingDescriptionForUpdateSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
@@ -550,7 +550,7 @@ FOR UPDATE SKIP LOCKED;
|
||||
|
||||
func ResetStaleDescriptionProcessing(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
staleAfter time.Duration,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -63,7 +63,7 @@ var (
|
||||
)
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (ej *ExportJob) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (ej *ExportJob) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM export_jobs WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -79,7 +79,7 @@ func (ej *ExportJob) AuthorizationAttributes(ctx context.Context, conn pg.Conn)
|
||||
|
||||
func (ej *ExportJob) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -121,7 +121,7 @@ INSERT INTO export_jobs (
|
||||
|
||||
func (ej *ExportJob) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -153,7 +153,7 @@ WHERE
|
||||
|
||||
func (ej *ExportJob) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -197,7 +197,7 @@ WHERE
|
||||
|
||||
func (ej *ExportJob) LoadNextPendingForUpdateSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
|
||||
@@ -65,7 +65,7 @@ func (f *File) GetMimeType() string {
|
||||
var _ filemanager.File = (*File)(nil)
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (f *File) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (f *File) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM files WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -81,7 +81,7 @@ func (f *File) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[s
|
||||
|
||||
func (f *File) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
fileID gid.GID,
|
||||
) error {
|
||||
@@ -133,7 +133,7 @@ LIMIT 1;
|
||||
|
||||
func (f *Files) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
fileIDs []gid.GID,
|
||||
) error {
|
||||
@@ -179,7 +179,7 @@ WHERE
|
||||
|
||||
func (f File) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -245,7 +245,7 @@ VALUES (
|
||||
|
||||
func (f *File) LoadPublicByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
fileID gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
@@ -292,7 +292,7 @@ LIMIT 1;
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f File) SoftDelete(ctx context.Context, conn pg.Conn, scope Scoper) error {
|
||||
func (f File) SoftDelete(ctx context.Context, conn pg.Tx, scope Scoper) error {
|
||||
q := `
|
||||
UPDATE files
|
||||
SET deleted_at = NOW()
|
||||
|
||||
@@ -74,7 +74,7 @@ func (f *Finding) CursorKey(field FindingOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", field))
|
||||
}
|
||||
|
||||
func (f *Finding) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (f *Finding) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM findings WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -90,7 +90,7 @@ func (f *Finding) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (ma
|
||||
|
||||
func (f *Finding) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
findingID gid.GID,
|
||||
) error {
|
||||
@@ -145,7 +145,7 @@ LIMIT 1;
|
||||
|
||||
func (fs *Findings) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *FindingFilter,
|
||||
@@ -180,7 +180,7 @@ WHERE
|
||||
|
||||
func (fs *Findings) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[FindingOrderField],
|
||||
@@ -240,7 +240,7 @@ WHERE
|
||||
|
||||
func (f *Finding) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
lockQuery := `SELECT pg_advisory_xact_lock(hashtext(@organization_id::text))`
|
||||
@@ -336,7 +336,7 @@ RETURNING reference_id
|
||||
|
||||
func (f *Finding) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -389,7 +389,7 @@ WHERE
|
||||
|
||||
func (f *Finding) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -412,7 +412,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fs Findings) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
func (fs Findings) Snapshot(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
query := `
|
||||
INSERT INTO findings (
|
||||
id,
|
||||
@@ -503,7 +503,7 @@ WHERE %s AND live.organization_id = @organization_id
|
||||
|
||||
func (fs *Findings) LoadByAuditID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
auditID gid.GID,
|
||||
cursor *page.Cursor[FindingOrderField],
|
||||
@@ -589,7 +589,7 @@ WHERE %s
|
||||
|
||||
func (fs *Findings) CountByAuditID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
auditID gid.GID,
|
||||
filter *FindingFilter,
|
||||
|
||||
@@ -39,7 +39,7 @@ type (
|
||||
|
||||
func (fa FindingAudit) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -81,7 +81,7 @@ ON CONFLICT (finding_id, audit_id) DO NOTHING;
|
||||
|
||||
func (fa FindingAudit) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
findingID gid.GID,
|
||||
auditID gid.GID,
|
||||
|
||||
@@ -54,7 +54,7 @@ func (f *Framework) CursorKey(orderBy FrameworkOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (f *Framework) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (f *Framework) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM frameworks WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -70,7 +70,7 @@ func (f *Framework) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (
|
||||
|
||||
func (f *Frameworks) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -101,7 +101,7 @@ WHERE
|
||||
|
||||
func (f *Frameworks) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[FrameworkOrderField],
|
||||
@@ -147,7 +147,7 @@ WHERE
|
||||
|
||||
func (f *Framework) LoadByReferenceID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
referenceID string,
|
||||
) error {
|
||||
@@ -195,7 +195,7 @@ LIMIT 1;
|
||||
|
||||
func (f *Framework) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
frameworkID gid.GID,
|
||||
) error {
|
||||
@@ -243,7 +243,7 @@ LIMIT 1;
|
||||
|
||||
func (f *Frameworks) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
frameworkIDs []gid.GID,
|
||||
) error {
|
||||
@@ -287,7 +287,7 @@ WHERE
|
||||
|
||||
func (f Framework) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -348,7 +348,7 @@ VALUES (
|
||||
|
||||
func (f Framework) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
frameworkID gid.GID,
|
||||
) error {
|
||||
@@ -371,7 +371,7 @@ WHERE
|
||||
|
||||
func (f *Framework) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -56,7 +56,7 @@ func (i Identity) CursorKey(orderBy IdentityOrderField) page.CursorKey {
|
||||
// Tenant id scope is not applied because we want to access identities across all tenants for authentication purposes.
|
||||
func (i *Identity) LoadByEmail(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
email mail.Addr,
|
||||
) error {
|
||||
q := `
|
||||
@@ -100,7 +100,7 @@ LIMIT 1;
|
||||
// Tenant id scope is not applied because we want to access identities across all tenants for authentication purposes.
|
||||
func (i *Identity) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
identityID gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
@@ -143,7 +143,7 @@ LIMIT 1;
|
||||
|
||||
// AuthorizationAttributes loads the minimal authorization attributes for policy condition evaluation.
|
||||
// It is intentionally lightweight and does not populate the Identity struct.
|
||||
func (i *Identity) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (i *Identity) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `
|
||||
SELECT
|
||||
id,
|
||||
@@ -173,7 +173,7 @@ WHERE
|
||||
|
||||
func (i *Identity) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
INSERT INTO
|
||||
@@ -217,7 +217,7 @@ VALUES (
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *Identity) Update(ctx context.Context, conn pg.Conn) error {
|
||||
func (i *Identity) Update(ctx context.Context, conn pg.Tx) error {
|
||||
q := `
|
||||
UPDATE
|
||||
identities
|
||||
@@ -257,7 +257,7 @@ WHERE
|
||||
// LoadBySAMLSubject loads an identity by their SAML subject (NameID)
|
||||
func (i *Identity) LoadBySAMLSubject(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
samlSubject string,
|
||||
) error {
|
||||
q := `
|
||||
@@ -300,7 +300,7 @@ LIMIT 1;
|
||||
|
||||
func (i *Identity) CountMemberships(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
) (int, error) {
|
||||
q := `
|
||||
SELECT
|
||||
|
||||
@@ -50,7 +50,7 @@ func (i Invitation) CursorKey(orderBy InvitationOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (i *Invitation) Insert(ctx context.Context, conn pg.Conn, scope Scoper) error {
|
||||
func (i *Invitation) Insert(ctx context.Context, conn pg.Tx, scope Scoper) error {
|
||||
query := `
|
||||
INSERT INTO
|
||||
iam_invitations (
|
||||
@@ -90,7 +90,7 @@ VALUES (
|
||||
|
||||
func (i *Invitation) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -141,7 +141,7 @@ WHERE
|
||||
|
||||
// AuthorizationAttributes loads the minimal authorization attributes for policy condition evaluation.
|
||||
// It is intentionally lightweight and does not populate the Invitation struct.
|
||||
func (i *Invitation) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (i *Invitation) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `
|
||||
SELECT
|
||||
email, organization_id
|
||||
@@ -167,7 +167,7 @@ LIMIT 1;
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (i *Invitation) Update(ctx context.Context, conn pg.Conn, scope Scoper) error {
|
||||
func (i *Invitation) Update(ctx context.Context, conn pg.Tx, scope Scoper) error {
|
||||
query := `
|
||||
UPDATE
|
||||
iam_invitations
|
||||
@@ -198,7 +198,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *Invitation) Delete(ctx context.Context, conn pg.Conn, scope Scoper, invitationID gid.GID) error {
|
||||
func (i *Invitation) Delete(ctx context.Context, conn pg.Tx, scope Scoper, invitationID gid.GID) error {
|
||||
query := `
|
||||
DELETE FROM
|
||||
iam_invitations
|
||||
@@ -228,7 +228,7 @@ WHERE
|
||||
|
||||
func (i *Invitations) LoadByUserID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
userID gid.GID,
|
||||
cursor *page.Cursor[InvitationOrderField],
|
||||
@@ -281,7 +281,7 @@ WHERE
|
||||
|
||||
func (i *Invitations) ExpireByUserID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
userID gid.GID,
|
||||
filter *InvitationFilter,
|
||||
|
||||
@@ -35,7 +35,7 @@ type MailingList struct {
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
|
||||
func (ml *MailingList) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (ml *MailingList) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM mailing_lists WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -51,7 +51,7 @@ func (ml *MailingList) AuthorizationAttributes(ctx context.Context, conn pg.Conn
|
||||
|
||||
func (ml *MailingList) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -95,7 +95,7 @@ LIMIT 1;
|
||||
|
||||
func (ml *MailingList) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -131,7 +131,7 @@ WHERE
|
||||
|
||||
func (ml *MailingList) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -44,7 +44,7 @@ type (
|
||||
MailingListSubscribers []*MailingListSubscriber
|
||||
)
|
||||
|
||||
func (cns *MailingListSubscriber) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (cns *MailingListSubscriber) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM mailing_list_subscribers WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -69,7 +69,7 @@ func (cns *MailingListSubscriber) CursorKey(orderBy MailingListSubscriberOrderFi
|
||||
|
||||
func (cns *MailingListSubscriber) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -119,7 +119,7 @@ LIMIT 1;
|
||||
|
||||
func (cns *MailingListSubscriber) LoadByMailingListIDAndEmail(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
mailingListID gid.GID,
|
||||
email mail.Addr,
|
||||
@@ -172,7 +172,7 @@ LIMIT 1;
|
||||
|
||||
func (cns *MailingListSubscriber) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -225,7 +225,7 @@ VALUES (
|
||||
|
||||
func (cns *MailingListSubscriber) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -261,7 +261,7 @@ WHERE
|
||||
|
||||
func (cns *MailingListSubscriber) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -291,7 +291,7 @@ WHERE
|
||||
|
||||
func (cnss *MailingListSubscribers) CountByMailingListID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
mailingListID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -323,7 +323,7 @@ WHERE
|
||||
|
||||
func (cnss *MailingListSubscribers) LoadAllConfirmedByMailingListID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
mailingListID gid.GID,
|
||||
) error {
|
||||
@@ -367,7 +367,7 @@ WHERE
|
||||
|
||||
func (cnss *MailingListSubscribers) LoadByMailingListID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
mailingListID gid.GID,
|
||||
cursor *page.Cursor[MailingListSubscriberOrderField],
|
||||
|
||||
@@ -53,7 +53,7 @@ func (mlu *MailingListUpdate) CursorKey(orderBy MailingListUpdateOrderField) pag
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (mlu *MailingListUpdate) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (mlu *MailingListUpdate) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM mailing_list_updates WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -67,7 +67,7 @@ func (mlu *MailingListUpdate) AuthorizationAttributes(ctx context.Context, conn
|
||||
return map[string]string{"organization_id": organizationID.String()}, nil
|
||||
}
|
||||
|
||||
func (mlu *MailingListUpdate) Insert(ctx context.Context, conn pg.Conn, scope Scoper) error {
|
||||
func (mlu *MailingListUpdate) Insert(ctx context.Context, conn pg.Tx, scope Scoper) error {
|
||||
q := `
|
||||
INSERT INTO mailing_list_updates (
|
||||
id,
|
||||
@@ -107,7 +107,7 @@ INSERT INTO mailing_list_updates (
|
||||
return err
|
||||
}
|
||||
|
||||
func (mlu *MailingListUpdate) Update(ctx context.Context, conn pg.Conn, scope Scoper) error {
|
||||
func (mlu *MailingListUpdate) Update(ctx context.Context, conn pg.Tx, scope Scoper) error {
|
||||
q := `
|
||||
UPDATE mailing_list_updates
|
||||
SET
|
||||
@@ -140,7 +140,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mlu *MailingListUpdate) Delete(ctx context.Context, conn pg.Conn, scope Scoper) error {
|
||||
func (mlu *MailingListUpdate) Delete(ctx context.Context, conn pg.Tx, scope Scoper) error {
|
||||
q := `
|
||||
DELETE FROM mailing_list_updates
|
||||
WHERE
|
||||
@@ -164,7 +164,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mlu *MailingListUpdate) LoadByID(ctx context.Context, conn pg.Conn, scope Scoper, id gid.GID) error {
|
||||
func (mlu *MailingListUpdate) LoadByID(ctx context.Context, conn pg.Querier, scope Scoper, id gid.GID) error {
|
||||
q := `
|
||||
SELECT
|
||||
id,
|
||||
@@ -207,7 +207,7 @@ LIMIT 1;
|
||||
|
||||
func (mlul *MailingListUpdateItems) LoadSentByMailingListID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
mailingListID gid.GID,
|
||||
cursor *page.Cursor[MailingListUpdateOrderField],
|
||||
@@ -254,7 +254,7 @@ WHERE
|
||||
|
||||
func (mlul *MailingListUpdateItems) LoadByMailingListID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
mailingListID gid.GID,
|
||||
cursor *page.Cursor[MailingListUpdateOrderField],
|
||||
@@ -300,7 +300,7 @@ WHERE
|
||||
|
||||
func (mlul *MailingListUpdateItems) CountByMailingListID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
mailingListID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -329,7 +329,7 @@ WHERE
|
||||
|
||||
func (mlu *MailingListUpdate) LoadNextEnqueuedForUpdateSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
@@ -367,7 +367,7 @@ FOR UPDATE SKIP LOCKED
|
||||
|
||||
func ResetStaleProcessingMailingListUpdates(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
staleAfter time.Duration,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -57,7 +57,7 @@ func (m Measure) CursorKey(orderBy MeasureOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (m *Measure) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (m *Measure) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM measures WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -73,7 +73,7 @@ func (m *Measure) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (ma
|
||||
|
||||
func (m *Measures) CountByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
filter *MeasureFilter,
|
||||
@@ -118,7 +118,7 @@ WHERE %s
|
||||
|
||||
func (m *Measures) LoadByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
cursor *page.Cursor[MeasureOrderField],
|
||||
@@ -185,7 +185,7 @@ WHERE %s
|
||||
|
||||
func (m *Measures) CountByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
filter *MeasureFilter,
|
||||
@@ -230,7 +230,7 @@ WITH mtgtns AS (
|
||||
|
||||
func (m *Measures) LoadByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
cursor *page.Cursor[MeasureOrderField],
|
||||
@@ -297,7 +297,7 @@ WHERE %s
|
||||
|
||||
func (m *Measures) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *MeasureFilter,
|
||||
@@ -330,7 +330,7 @@ WHERE
|
||||
|
||||
func (m *Measures) LoadDistinctCategoriesByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) ([]string, error) {
|
||||
@@ -365,7 +365,7 @@ ORDER BY
|
||||
|
||||
func (m *Measures) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[MeasureOrderField],
|
||||
@@ -414,7 +414,7 @@ WHERE
|
||||
|
||||
func (m *Measure) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
) error {
|
||||
@@ -463,7 +463,7 @@ LIMIT 1;
|
||||
|
||||
func (m *Measures) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureIDs []gid.GID,
|
||||
) error {
|
||||
@@ -507,7 +507,7 @@ WHERE
|
||||
|
||||
func (m *Measure) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -583,7 +583,7 @@ RETURNING
|
||||
|
||||
func (m Measure) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -643,7 +643,7 @@ VALUES (
|
||||
|
||||
func (m *Measure) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -676,7 +676,7 @@ WHERE %s
|
||||
|
||||
func (m *Measure) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -55,7 +55,7 @@ func (m Meeting) CursorKey(orderBy MeetingOrderField) page.CursorKey {
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (m *Meeting) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (m *Meeting) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM meetings WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -71,7 +71,7 @@ func (m *Meeting) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (ma
|
||||
|
||||
func (m *Meeting) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
meetingID gid.GID,
|
||||
) error {
|
||||
@@ -117,7 +117,7 @@ LIMIT 1;
|
||||
|
||||
func (m *Meetings) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[MeetingOrderField],
|
||||
@@ -160,7 +160,7 @@ WHERE
|
||||
|
||||
func (m *Meetings) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -191,7 +191,7 @@ WHERE
|
||||
|
||||
func (m *Meeting) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -239,7 +239,7 @@ VALUES (
|
||||
|
||||
func (m *Meeting) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -278,7 +278,7 @@ WHERE %s
|
||||
|
||||
func (m *Meeting) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -37,7 +37,7 @@ type (
|
||||
|
||||
func (ma *MeetingAttendees) Merge(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
meetingID gid.GID,
|
||||
organizationID gid.GID,
|
||||
|
||||
@@ -54,7 +54,7 @@ func (m Membership) CursorKey(orderBy MembershipOrderField) page.CursorKey {
|
||||
|
||||
func (m *Membership) LoadByIdentityIDAndOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
identityID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -102,7 +102,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Membership) Insert(ctx context.Context, conn pg.Conn, scope Scoper) error {
|
||||
func (m *Membership) Insert(ctx context.Context, conn pg.Tx, scope Scoper) error {
|
||||
query := `
|
||||
INSERT INTO
|
||||
iam_memberships (
|
||||
@@ -154,7 +154,7 @@ VALUES (
|
||||
|
||||
func (m *Membership) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
membershipID gid.GID,
|
||||
) error {
|
||||
@@ -198,7 +198,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Membership) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (m *Membership) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `
|
||||
SELECT
|
||||
identity_id,
|
||||
@@ -234,7 +234,7 @@ LIMIT 1;
|
||||
|
||||
func (m *Membership) LoadByIdentityAndOrg(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
identityID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -281,7 +281,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Membership) Update(ctx context.Context, conn pg.Conn, scope Scoper) error {
|
||||
func (m *Membership) Update(ctx context.Context, conn pg.Tx, scope Scoper) error {
|
||||
query := `
|
||||
UPDATE
|
||||
iam_memberships
|
||||
@@ -314,7 +314,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Membership) Delete(ctx context.Context, conn pg.Conn, scope Scoper, membershipID gid.GID) error {
|
||||
func (m *Membership) Delete(ctx context.Context, conn pg.Tx, scope Scoper, membershipID gid.GID) error {
|
||||
query := `
|
||||
DELETE FROM
|
||||
iam_memberships
|
||||
@@ -344,7 +344,7 @@ WHERE
|
||||
|
||||
func (m *Membership) LoadActiveByIdentityIDAndOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
identityID gid.GID,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -87,7 +87,7 @@ func (p MembershipProfile) CursorKey(orderBy MembershipProfileOrderField) page.C
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (p *MembershipProfile) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (p *MembershipProfile) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id, identity_id FROM iam_membership_profiles WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -107,7 +107,7 @@ func (p *MembershipProfile) AuthorizationAttributes(ctx context.Context, conn pg
|
||||
|
||||
func (p *MembershipProfile) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
profileID gid.GID,
|
||||
) error {
|
||||
@@ -183,7 +183,7 @@ LIMIT 1;
|
||||
|
||||
func (p *MembershipProfile) LoadByIdentityIDAndOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
identityID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -264,7 +264,7 @@ LIMIT 1;
|
||||
|
||||
func (p *MembershipProfiles) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
profileIDs []gid.GID,
|
||||
) error {
|
||||
@@ -335,7 +335,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfiles) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[MembershipProfileOrderField],
|
||||
@@ -449,7 +449,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfiles) LoadByIdentityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
identityID gid.GID,
|
||||
cursor *page.Cursor[MembershipProfileOrderField],
|
||||
filter *MembershipProfileFilter,
|
||||
@@ -561,7 +561,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfiles) LoadByDocumentVersionID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
cursor *page.Cursor[MembershipProfileOrderField],
|
||||
@@ -682,7 +682,7 @@ INNER JOIN identities i ON i.id = p.identity_id
|
||||
|
||||
func (p *MembershipProfiles) CountByDocumentVersionID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentVersionID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -720,7 +720,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfiles) LoadByMeetingID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
meetingID gid.GID,
|
||||
) error {
|
||||
@@ -836,7 +836,7 @@ ORDER BY
|
||||
|
||||
func (p *MembershipProfiles) LoadAwaitingSigning(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -912,7 +912,7 @@ INNER JOIN signatories ON p.id = signatories.signed_by_profile_id
|
||||
|
||||
func (p *MembershipProfiles) CountByIdentityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
identityID gid.GID,
|
||||
filter *MembershipProfileFilter,
|
||||
) (int, error) {
|
||||
@@ -945,7 +945,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfiles) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *MembershipProfileFilter,
|
||||
@@ -981,7 +981,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfiles) CountActiveOwnerByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -1020,7 +1020,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfile) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
INSERT INTO
|
||||
@@ -1146,7 +1146,7 @@ VALUES (
|
||||
|
||||
func (p *MembershipProfile) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -1235,7 +1235,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfiles) ResetSCIMSources(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -1269,7 +1269,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfile) ClearExternalID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
externalID string,
|
||||
organizationID gid.GID,
|
||||
@@ -1305,7 +1305,7 @@ WHERE
|
||||
|
||||
func (p *MembershipProfile) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
profileID gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -65,7 +65,7 @@ func (o *Obligation) CursorKey(field ObligationOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", field))
|
||||
}
|
||||
|
||||
func (o *Obligation) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (o *Obligation) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM obligations WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -81,7 +81,7 @@ func (o *Obligation) AuthorizationAttributes(ctx context.Context, conn pg.Conn)
|
||||
|
||||
func (o *Obligation) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
obligationID gid.GID,
|
||||
) error {
|
||||
@@ -133,7 +133,7 @@ LIMIT 1;
|
||||
|
||||
func (os *Obligations) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *ObligationFilter,
|
||||
@@ -168,7 +168,7 @@ WHERE
|
||||
|
||||
func (os *Obligations) CountByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
filter *ObligationFilter,
|
||||
@@ -214,7 +214,7 @@ WHERE %s
|
||||
|
||||
func (os *Obligations) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[ObligationOrderField],
|
||||
@@ -271,7 +271,7 @@ WHERE
|
||||
|
||||
func (os *Obligations) LoadByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
cursor *page.Cursor[ObligationOrderField],
|
||||
@@ -353,7 +353,7 @@ WHERE %s
|
||||
|
||||
func (os *Obligations) CountByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
filter *ObligationFilter,
|
||||
@@ -398,7 +398,7 @@ WHERE %s
|
||||
|
||||
func (os *Obligations) LoadByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
cursor *page.Cursor[ObligationOrderField],
|
||||
@@ -478,7 +478,7 @@ WHERE %s
|
||||
|
||||
func (o *Obligation) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -551,7 +551,7 @@ INSERT INTO obligations (
|
||||
|
||||
func (o *Obligation) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -601,7 +601,7 @@ WHERE
|
||||
|
||||
func (o *Obligation) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -625,7 +625,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (os Obligations) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
func (os Obligations) Snapshot(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
query := `
|
||||
INSERT INTO obligations (
|
||||
id,
|
||||
|
||||
@@ -34,7 +34,7 @@ type OIDCState struct {
|
||||
ExpiresAt time.Time `db:"expires_at"`
|
||||
}
|
||||
|
||||
func (s *OIDCState) Insert(ctx context.Context, conn pg.Conn) error {
|
||||
func (s *OIDCState) Insert(ctx context.Context, conn pg.Tx) error {
|
||||
query := `
|
||||
INSERT INTO iam_oidc_states (id, provider, nonce, code_verifier, continue_url, created_at, expires_at)
|
||||
VALUES (@id, @provider, @nonce, @code_verifier, @continue_url, @created_at, @expires_at)
|
||||
@@ -58,7 +58,7 @@ VALUES (@id, @provider, @nonce, @code_verifier, @continue_url, @created_at, @exp
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *OIDCState) LoadByIDForUpdate(ctx context.Context, conn pg.Conn, id string) error {
|
||||
func (s *OIDCState) LoadByIDForUpdate(ctx context.Context, conn pg.Tx, id string) error {
|
||||
query := `
|
||||
SELECT id, provider, nonce, code_verifier, continue_url, created_at, expires_at
|
||||
FROM iam_oidc_states
|
||||
@@ -83,7 +83,7 @@ FOR UPDATE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *OIDCState) Delete(ctx context.Context, conn pg.Conn) error {
|
||||
func (s *OIDCState) Delete(ctx context.Context, conn pg.Tx) error {
|
||||
query := `DELETE FROM iam_oidc_states WHERE id = @id`
|
||||
|
||||
_, err := conn.Exec(ctx, query, pgx.StrictNamedArgs{"id": s.ID})
|
||||
@@ -94,7 +94,7 @@ func (s *OIDCState) Delete(ctx context.Context, conn pg.Conn) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *OIDCState) DeleteExpired(ctx context.Context, conn pg.Conn, now time.Time) (int64, error) {
|
||||
func (s *OIDCState) DeleteExpired(ctx context.Context, conn pg.Tx, now time.Time) (int64, error) {
|
||||
query := `DELETE FROM iam_oidc_states WHERE expires_at < @now`
|
||||
|
||||
result, err := conn.Exec(ctx, query, pgx.StrictNamedArgs{"now": now})
|
||||
|
||||
@@ -46,7 +46,7 @@ type (
|
||||
Organizations []*Organization
|
||||
)
|
||||
|
||||
func (o *Organization) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (o *Organization) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT id FROM organizations WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var id gid.GID
|
||||
@@ -75,7 +75,7 @@ func (o Organization) CursorKey(orderBy OrganizationOrderField) page.CursorKey {
|
||||
|
||||
func (o *Organization) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -127,7 +127,7 @@ LIMIT 1;
|
||||
|
||||
func (o *Organizations) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationIDs []gid.GID,
|
||||
) error {
|
||||
@@ -174,7 +174,7 @@ WHERE
|
||||
|
||||
func (o *Organizations) LoadByIdentityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
identityID gid.GID,
|
||||
cursor *page.Cursor[OrganizationOrderField],
|
||||
@@ -232,7 +232,7 @@ WHERE
|
||||
|
||||
func (o *Organization) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
INSERT INTO organizations (
|
||||
@@ -277,7 +277,7 @@ INSERT INTO organizations (
|
||||
func (o *Organization) Update(
|
||||
ctx context.Context,
|
||||
scope Scoper,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
UPDATE organizations
|
||||
@@ -323,7 +323,7 @@ WHERE
|
||||
|
||||
func (o *Organization) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
@@ -343,7 +343,7 @@ WHERE id = @id
|
||||
|
||||
func (o *Organization) LoadByCustomDomainID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
customDomainID gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -41,7 +41,7 @@ type (
|
||||
|
||||
func (oc *OrganizationContext) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -89,7 +89,7 @@ LIMIT 1;
|
||||
|
||||
func (oc *OrganizationContext) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -138,7 +138,7 @@ INSERT INTO organization_contexts (
|
||||
|
||||
func (oc *OrganizationContext) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -52,7 +52,7 @@ func (a *PersonalAPIKey) CursorKey(orderBy PersonalAPIKeyOrderField) page.Cursor
|
||||
|
||||
func (a *PersonalAPIKey) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
apiKeyID gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
@@ -93,7 +93,7 @@ LIMIT 1;
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *PersonalAPIKey) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (a *PersonalAPIKey) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := "SELECT identity_id FROM iam_personal_api_keys WHERE id = $1 LIMIT 1;"
|
||||
|
||||
var identityID gid.GID
|
||||
@@ -109,7 +109,7 @@ func (a *PersonalAPIKey) AuthorizationAttributes(ctx context.Context, conn pg.Co
|
||||
|
||||
func (a *PersonalAPIKeys) LoadByIdentityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
identityID gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
@@ -146,7 +146,7 @@ ORDER BY created_at DESC;
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *PersonalAPIKeys) CountByIdentityID(ctx context.Context, conn pg.Conn, identityID gid.GID) (int, error) {
|
||||
func (a *PersonalAPIKeys) CountByIdentityID(ctx context.Context, conn pg.Querier, identityID gid.GID) (int, error) {
|
||||
q := `
|
||||
SELECT
|
||||
COUNT(*)
|
||||
@@ -169,7 +169,7 @@ ORDER BY created_at DESC;
|
||||
|
||||
func (a *PersonalAPIKey) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
INSERT INTO
|
||||
@@ -207,7 +207,7 @@ VALUES (
|
||||
|
||||
func (a *PersonalAPIKey) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
UPDATE
|
||||
@@ -241,7 +241,7 @@ WHERE
|
||||
|
||||
func (a *PersonalAPIKey) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
DELETE FROM
|
||||
|
||||
@@ -70,7 +70,7 @@ func (p *ProcessingActivity) CursorKey(field ProcessingActivityOrderField) page.
|
||||
panic(fmt.Sprintf("unsupported order by: %s", field))
|
||||
}
|
||||
|
||||
func (p *ProcessingActivity) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (p *ProcessingActivity) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM processing_activities WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -86,7 +86,7 @@ func (p *ProcessingActivity) AuthorizationAttributes(ctx context.Context, conn p
|
||||
|
||||
func (p *ProcessingActivity) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
processingActivityID gid.GID,
|
||||
) error {
|
||||
@@ -147,7 +147,7 @@ LIMIT 1;
|
||||
|
||||
func (p *ProcessingActivities) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *ProcessingActivityFilter,
|
||||
@@ -182,7 +182,7 @@ WHERE
|
||||
|
||||
func (p *ProcessingActivities) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[ProcessingActivityOrderField],
|
||||
@@ -248,7 +248,7 @@ WHERE
|
||||
|
||||
func (p *ProcessingActivities) LoadAllByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *ProcessingActivityFilter,
|
||||
@@ -312,7 +312,7 @@ ORDER BY created_at DESC
|
||||
|
||||
func (p *ProcessingActivity) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -412,7 +412,7 @@ INSERT INTO processing_activities (
|
||||
|
||||
func (p *ProcessingActivity) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -481,7 +481,7 @@ WHERE
|
||||
|
||||
func (p *ProcessingActivity) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -505,7 +505,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pas ProcessingActivities) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
func (pas ProcessingActivities) Snapshot(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
snapshotters := []ProcessingActivitySnapshotter{ProcessingActivities{}, Vendors{}, ProcessingActivityVendors{}, DataProtectionImpactAssessments{}, TransferImpactAssessments{}}
|
||||
|
||||
for _, snapshotter := range snapshotters {
|
||||
@@ -519,7 +519,7 @@ func (pas ProcessingActivities) Snapshot(ctx context.Context, conn pg.Conn, scop
|
||||
|
||||
func (pas ProcessingActivities) InsertProcessingActivitySnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -37,13 +37,13 @@ type (
|
||||
ProcessingActivityVendors []*ProcessingActivityVendor
|
||||
|
||||
ProcessingActivitySnapshotter interface {
|
||||
InsertProcessingActivitySnapshots(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
InsertProcessingActivitySnapshots(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
}
|
||||
)
|
||||
|
||||
func (pav ProcessingActivityVendors) Merge(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
processingActivityID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -89,7 +89,7 @@ WHEN NOT MATCHED
|
||||
|
||||
func (pav ProcessingActivityVendors) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
processingActivityID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -127,7 +127,7 @@ FROM vendor_ids
|
||||
|
||||
func (pav ProcessingActivityVendors) InsertProcessingActivitySnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -42,7 +42,7 @@ type (
|
||||
Reports []*Report
|
||||
)
|
||||
|
||||
func (r *Report) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (r *Report) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM reports WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -58,7 +58,7 @@ func (r *Report) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map
|
||||
|
||||
func (r *Report) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
reportID gid.GID,
|
||||
) error {
|
||||
@@ -106,7 +106,7 @@ LIMIT 1;
|
||||
|
||||
func (r *Reports) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
reportIDs []gid.GID,
|
||||
) error {
|
||||
@@ -149,7 +149,7 @@ WHERE
|
||||
|
||||
func (r *Report) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -198,7 +198,7 @@ INSERT INTO reports (
|
||||
|
||||
func (r *Report) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -236,7 +236,7 @@ WHERE
|
||||
|
||||
func (r *Report) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -61,7 +61,7 @@ func (rr *RightsRequest) CursorKey(field RightsRequestOrderField) page.CursorKey
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (rr *RightsRequest) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (rr *RightsRequest) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM rights_requests WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -77,7 +77,7 @@ func (rr *RightsRequest) AuthorizationAttributes(ctx context.Context, conn pg.Co
|
||||
|
||||
func (rr *RightsRequest) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
rightsRequestID gid.GID,
|
||||
) error {
|
||||
@@ -128,7 +128,7 @@ LIMIT 1;
|
||||
|
||||
func (rrs *RightsRequests) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -160,7 +160,7 @@ WHERE
|
||||
|
||||
func (rrs *RightsRequests) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[RightsRequestOrderField],
|
||||
@@ -209,7 +209,7 @@ WHERE
|
||||
|
||||
func (rr *RightsRequest) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -267,7 +267,7 @@ INSERT INTO rights_requests (
|
||||
|
||||
func (rr *RightsRequest) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -310,7 +310,7 @@ WHERE
|
||||
|
||||
func (rr *RightsRequest) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -55,7 +55,7 @@ type (
|
||||
Risks []*Risk
|
||||
|
||||
RiskSnapshotter interface {
|
||||
InsertRiskSnapshots(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
InsertRiskSnapshots(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
}
|
||||
)
|
||||
|
||||
@@ -80,7 +80,7 @@ func (r *Risk) CursorKey(orderBy RiskOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (r *Risk) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (r *Risk) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM risks WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -96,7 +96,7 @@ func (r *Risk) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[s
|
||||
|
||||
func (r *Risks) CountByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
filter *RiskFilter,
|
||||
@@ -140,7 +140,7 @@ WHERE %s
|
||||
|
||||
func (r *Risks) LoadByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
cursor *page.Cursor[RiskOrderField],
|
||||
@@ -229,7 +229,7 @@ WHERE %s
|
||||
|
||||
func (r *Risks) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *RiskFilter,
|
||||
@@ -260,7 +260,7 @@ WHERE %s
|
||||
|
||||
func (r *Risks) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[RiskOrderField],
|
||||
@@ -347,7 +347,7 @@ WHERE %s
|
||||
|
||||
func (r *Risk) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
) error {
|
||||
@@ -403,7 +403,7 @@ LIMIT 1;
|
||||
|
||||
func (r *Risks) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
riskIDs []gid.GID,
|
||||
) error {
|
||||
@@ -454,7 +454,7 @@ WHERE %s
|
||||
|
||||
func (r *Risk) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -486,7 +486,7 @@ VALUES (@id, @tenant_id, @organization_id, @name, @description, @category, @owne
|
||||
|
||||
func (r *Risk) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -531,7 +531,7 @@ WHERE %s
|
||||
|
||||
func (r *Risk) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
) error {
|
||||
@@ -549,7 +549,7 @@ DELETE FROM risks WHERE %s AND id = @id AND snapshot_id IS NULL
|
||||
|
||||
func (r *Risks) CountByDocumentID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
filter *RiskFilter,
|
||||
@@ -591,7 +591,7 @@ WHERE %s
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (r Risks) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
func (r Risks) Snapshot(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
if err := r.InsertRiskSnapshots(ctx, conn, scope, organizationID, snapshotID); err != nil {
|
||||
return fmt.Errorf("cannot create risk snapshots: %w", err)
|
||||
}
|
||||
@@ -601,7 +601,7 @@ func (r Risks) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organiz
|
||||
|
||||
func (r Risks) InsertRiskSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -39,7 +39,7 @@ type (
|
||||
|
||||
func (rp RiskDocument) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -73,7 +73,7 @@ VALUES (
|
||||
|
||||
func (rp RiskDocument) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
documentID gid.GID,
|
||||
@@ -102,7 +102,7 @@ WHERE
|
||||
|
||||
func (rp RiskDocument) DeleteByDocumentIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
documentIDs []gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -39,7 +39,7 @@ type (
|
||||
|
||||
func (rm RiskMeasure) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -73,7 +73,7 @@ VALUES (
|
||||
|
||||
func (rm RiskMeasure) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
measureID gid.GID,
|
||||
|
||||
@@ -38,7 +38,7 @@ type (
|
||||
|
||||
func (ro RiskObligation) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -75,7 +75,7 @@ INSERT INTO risks_obligations (
|
||||
|
||||
func (ro RiskObligation) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -35,7 +35,7 @@ type SAMLAssertion struct {
|
||||
|
||||
func (s *SAMLAssertion) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
query := `
|
||||
INSERT INTO iam_saml_assertions (id, organization_id, used_at, expires_at)
|
||||
@@ -62,7 +62,7 @@ VALUES (@id, @organization_id, @used_at, @expires_at)
|
||||
return nil
|
||||
}
|
||||
|
||||
func DeleteExpiredSAMLAssertions(ctx context.Context, conn pg.Conn, now time.Time) (int64, error) {
|
||||
func DeleteExpiredSAMLAssertions(ctx context.Context, conn pg.Tx, now time.Time) (int64, error) {
|
||||
query := `
|
||||
DELETE FROM iam_saml_assertions
|
||||
WHERE expires_at < @now
|
||||
|
||||
@@ -63,7 +63,7 @@ func (s *SAMLConfiguration) CursorKey(orderBy SAMLConfigurationOrderField) page.
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (s *SAMLConfiguration) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (s *SAMLConfiguration) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM iam_saml_configurations WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -93,7 +93,7 @@ func (s *SAMLConfiguration) GetIdPCertificate() (*x509.Certificate, error) {
|
||||
|
||||
func (s *SAMLConfiguration) LoadByOrganizationIDAndEmailDomain(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
emailDomain string,
|
||||
@@ -155,7 +155,7 @@ LIMIT 1;
|
||||
|
||||
func (s *SAMLConfiguration) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
configID gid.GID,
|
||||
) error {
|
||||
@@ -212,7 +212,7 @@ LIMIT 1;
|
||||
|
||||
func (s *SAMLConfiguration) LoadByIDForUpdateSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
configID gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
@@ -264,7 +264,7 @@ FOR UPDATE SKIP LOCKED;
|
||||
|
||||
func (s *SAMLConfiguration) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -347,7 +347,7 @@ INSERT INTO iam_saml_configurations (
|
||||
|
||||
func (s *SAMLConfiguration) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -402,7 +402,7 @@ WHERE
|
||||
|
||||
func (s *SAMLConfiguration) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -427,7 +427,7 @@ WHERE
|
||||
|
||||
func (s *SAMLConfigurations) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -480,7 +480,7 @@ ORDER BY email_domain ASC;
|
||||
|
||||
func (s *SAMLConfigurations) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -513,7 +513,7 @@ WHERE
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (s *SAMLConfigurations) LoadVerifiedByEmailDomain(ctx context.Context, conn pg.Conn, emailDomain string) error {
|
||||
func (s *SAMLConfigurations) LoadVerifiedByEmailDomain(ctx context.Context, conn pg.Querier, emailDomain string) error {
|
||||
q := `
|
||||
SELECT
|
||||
id,
|
||||
@@ -558,7 +558,7 @@ ORDER BY email_domain ASC;
|
||||
|
||||
func (s *SAMLConfigurations) CountVerifiedByEmailDomain(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
emailDomain string,
|
||||
) (int, error) {
|
||||
q := `
|
||||
@@ -582,7 +582,7 @@ WHERE
|
||||
|
||||
func (s *SAMLConfigurations) LoadUnverified(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
|
||||
@@ -33,7 +33,7 @@ type SAMLRequest struct {
|
||||
|
||||
func (s *SAMLRequest) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
query := `
|
||||
INSERT INTO iam_saml_requests (id, organization_id, created_at, expires_at)
|
||||
@@ -57,7 +57,7 @@ VALUES (@id, @organization_id, @created_at, @expires_at)
|
||||
|
||||
func LoadValidRequestIDsForOrganization(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
organizationID gid.GID,
|
||||
now time.Time,
|
||||
) ([]string, error) {
|
||||
@@ -89,7 +89,7 @@ WHERE organization_id = @organization_id AND expires_at > @now
|
||||
return requestIDs, nil
|
||||
}
|
||||
|
||||
func DeleteExpiredSAMLRequests(ctx context.Context, conn pg.Conn, now time.Time) (int64, error) {
|
||||
func DeleteExpiredSAMLRequests(ctx context.Context, conn pg.Tx, now time.Time) (int64, error) {
|
||||
query := `
|
||||
DELETE FROM iam_saml_requests
|
||||
WHERE expires_at < @now
|
||||
|
||||
@@ -60,7 +60,7 @@ func (s *SCIMBridge) CursorKey(orderBy SCIMBridgeOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (s *SCIMBridge) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (s *SCIMBridge) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM iam_scim_bridges WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -76,7 +76,7 @@ func (s *SCIMBridge) AuthorizationAttributes(ctx context.Context, conn pg.Conn)
|
||||
|
||||
func (s *SCIMBridge) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
bridgeID gid.GID,
|
||||
) error {
|
||||
@@ -131,7 +131,7 @@ LIMIT 1;
|
||||
|
||||
func (s *SCIMBridge) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -186,7 +186,7 @@ LIMIT 1;
|
||||
|
||||
func (s *SCIMBridge) LoadBySCIMConfigurationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
scimConfigurationID gid.GID,
|
||||
) error {
|
||||
@@ -241,7 +241,7 @@ LIMIT 1;
|
||||
|
||||
func (s *SCIMBridge) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -311,7 +311,7 @@ INSERT INTO iam_scim_bridges (
|
||||
|
||||
func (s *SCIMBridge) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -360,7 +360,7 @@ WHERE
|
||||
|
||||
func (s *SCIMBridge) LoadNextForSyncSkipLocked(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
staleSyncThreshold time.Duration,
|
||||
) error {
|
||||
staleCutoff := time.Now().Add(-staleSyncThreshold)
|
||||
@@ -418,7 +418,7 @@ FOR UPDATE SKIP LOCKED
|
||||
|
||||
func (s *SCIMBridge) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -50,7 +50,7 @@ func (s *SCIMConfiguration) CursorKey(orderBy SCIMConfigurationOrderField) page.
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (s *SCIMConfiguration) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (s *SCIMConfiguration) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM iam_scim_configurations WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -66,7 +66,7 @@ func (s *SCIMConfiguration) AuthorizationAttributes(ctx context.Context, conn pg
|
||||
|
||||
func (s *SCIMConfiguration) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
configID gid.GID,
|
||||
) error {
|
||||
@@ -124,7 +124,7 @@ LEFT JOIN
|
||||
|
||||
func (s *SCIMConfiguration) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -182,7 +182,7 @@ LEFT JOIN
|
||||
|
||||
func (s *SCIMConfiguration) LoadByHashedToken(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
hashedToken []byte,
|
||||
) error {
|
||||
q := `
|
||||
@@ -235,7 +235,7 @@ LEFT JOIN
|
||||
|
||||
func (s *SCIMConfiguration) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -282,7 +282,7 @@ INSERT INTO iam_scim_configurations (
|
||||
|
||||
func (s *SCIMConfiguration) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -315,7 +315,7 @@ WHERE
|
||||
|
||||
func (s *SCIMConfiguration) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -56,7 +56,7 @@ func (s *SCIMEvent) CursorKey(orderBy SCIMEventOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (s *SCIMEvent) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (s *SCIMEvent) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM iam_scim_events WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -72,7 +72,7 @@ func (s *SCIMEvent) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (
|
||||
|
||||
func (s *SCIMEvent) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
eventID gid.GID,
|
||||
) error {
|
||||
@@ -124,7 +124,7 @@ LIMIT 1;
|
||||
|
||||
func (s *SCIMEvent) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -185,7 +185,7 @@ INSERT INTO iam_scim_events (
|
||||
|
||||
func (s *SCIMEvents) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[SCIMEventOrderField],
|
||||
@@ -235,7 +235,7 @@ WHERE
|
||||
|
||||
func (s *SCIMEvents) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -265,7 +265,7 @@ WHERE
|
||||
|
||||
func (s *SCIMEvents) LoadBySCIMConfigurationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
scimConfigurationID gid.GID,
|
||||
cursor *page.Cursor[SCIMEventOrderField],
|
||||
@@ -315,7 +315,7 @@ WHERE
|
||||
|
||||
func (s *SCIMEvents) CountBySCIMConfigurationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
scimConfigurationID gid.GID,
|
||||
) (int, error) {
|
||||
|
||||
@@ -96,7 +96,7 @@ func (s *Session) IsChildSession() bool {
|
||||
|
||||
func (s *Session) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
sessionID gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
@@ -144,7 +144,7 @@ LIMIT 1;
|
||||
|
||||
// AuthorizationAttributes loads the minimal authorization attributes for policy condition evaluation.
|
||||
// It is intentionally lightweight and does not populate the Session struct.
|
||||
func (s *Session) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (s *Session) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `
|
||||
SELECT
|
||||
identity_id
|
||||
@@ -168,7 +168,7 @@ LIMIT 1;
|
||||
|
||||
func (s *Session) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
INSERT INTO
|
||||
@@ -214,7 +214,7 @@ VALUES (
|
||||
|
||||
func (s *Session) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
UPDATE iam_sessions
|
||||
@@ -251,7 +251,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Sessions) LoadByIdentityID(ctx context.Context, conn pg.Conn, identityID gid.GID, cursor *page.Cursor[SessionOrderField]) error {
|
||||
func (s *Sessions) LoadByIdentityID(ctx context.Context, conn pg.Querier, identityID gid.GID, cursor *page.Cursor[SessionOrderField]) error {
|
||||
q := `
|
||||
SELECT
|
||||
id,
|
||||
@@ -295,7 +295,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Sessions) CountByIdentityID(ctx context.Context, conn pg.Conn, identityID gid.GID) (int, error) {
|
||||
func (s *Sessions) CountByIdentityID(ctx context.Context, conn pg.Querier, identityID gid.GID) (int, error) {
|
||||
q := `
|
||||
SELECT
|
||||
COUNT(*)
|
||||
@@ -317,7 +317,7 @@ WHERE
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (s *Sessions) ExpireAllForIdentityExceptOneSession(ctx context.Context, conn pg.Conn, identityID gid.GID, sessionID gid.GID) (int64, error) {
|
||||
func (s *Sessions) ExpireAllForIdentityExceptOneSession(ctx context.Context, conn pg.Querier, identityID gid.GID, sessionID gid.GID) (int64, error) {
|
||||
q := `
|
||||
UPDATE iam_sessions
|
||||
SET
|
||||
@@ -345,7 +345,7 @@ WHERE
|
||||
|
||||
func (s *Session) LoadByRootSessionIDAndMembershipID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
rootSessionID gid.GID,
|
||||
membershipID gid.GID,
|
||||
) error {
|
||||
|
||||
@@ -57,7 +57,7 @@ func (e ErrSlackMessageNotFound) Error() string {
|
||||
return "slack message not found"
|
||||
}
|
||||
|
||||
func (sm *SlackMessage) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (sm *SlackMessage) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM slack_messages WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -92,7 +92,7 @@ func NewSlackMessage(
|
||||
|
||||
func (s *SlackMessage) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -151,7 +151,7 @@ VALUES (
|
||||
|
||||
func (s *SlackMessage) LoadNextUnsentForUpdate(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT id, organization_id, type, body, message_ts, channel_id, requester_email, metadata, initial_slack_message_id, created_at, updated_at, sent_at, error
|
||||
@@ -183,7 +183,7 @@ FOR UPDATE
|
||||
|
||||
func (s *SlackMessage) LoadNextInitalUnsentForUpdate(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT id, organization_id, type, body, message_ts, channel_id, requester_email, metadata, initial_slack_message_id, created_at, updated_at, sent_at, error
|
||||
@@ -215,7 +215,7 @@ FOR UPDATE
|
||||
|
||||
func (s *SlackMessage) LoadNextUpdateUnsentForUpdate(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
@@ -265,7 +265,7 @@ FOR UPDATE OF sm
|
||||
|
||||
func (s *SlackMessage) LoadInitialByChannelAndTS(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
channelID string,
|
||||
messageTS string,
|
||||
@@ -305,7 +305,7 @@ LIMIT 1
|
||||
|
||||
func (s *SlackMessage) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -335,7 +335,7 @@ WHERE id = @id AND %s
|
||||
|
||||
func (s *SlackMessage) UpdateChannelAndTSByInitialMessageID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
initialSlackMessageID gid.GID,
|
||||
channelID string,
|
||||
@@ -369,7 +369,7 @@ WHERE initial_slack_message_id = @initial_slack_message_id AND %s
|
||||
|
||||
func (s *SlackMessage) LoadById(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
slackMessageID gid.GID,
|
||||
) error {
|
||||
@@ -408,7 +408,7 @@ LIMIT 1
|
||||
|
||||
func (s *SlackMessage) LoadLatestByInitialMessageID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
initialSlackMessageID gid.GID,
|
||||
) error {
|
||||
@@ -448,7 +448,7 @@ LIMIT 1
|
||||
|
||||
func (s *SlackMessage) LoadLatestByRequesterEmailAndType(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
requesterEmail mail.Addr,
|
||||
|
||||
@@ -53,7 +53,7 @@ func (s *Snapshot) CursorKey(field SnapshotOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", field))
|
||||
}
|
||||
|
||||
func (s *Snapshot) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (s *Snapshot) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM snapshots WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -69,7 +69,7 @@ func (s *Snapshot) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (m
|
||||
|
||||
func (s *Snapshot) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
snapshotID gid.GID,
|
||||
) error {
|
||||
@@ -111,7 +111,7 @@ LIMIT 1;
|
||||
|
||||
func (s *Snapshots) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *SnapshotFilter,
|
||||
@@ -145,7 +145,7 @@ WHERE
|
||||
|
||||
func (s *Snapshots) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[SnapshotOrderField],
|
||||
@@ -189,7 +189,7 @@ WHERE
|
||||
|
||||
func (s *Snapshot) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -232,7 +232,7 @@ INSERT INTO snapshots (
|
||||
|
||||
func (s *Snapshot) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -258,7 +258,7 @@ WHERE
|
||||
|
||||
func (s *Snapshots) LoadByControlID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
controlID gid.GID,
|
||||
cursor *page.Cursor[SnapshotOrderField],
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
)
|
||||
|
||||
type Snapshottable interface {
|
||||
Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
Snapshot(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
}
|
||||
|
||||
func GetSnapshottable(snapshotType SnapshotsType) (Snapshottable, error) {
|
||||
|
||||
@@ -54,7 +54,7 @@ func (s StateOfApplicability) CursorKey(orderBy StateOfApplicabilityOrderField)
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (s *StateOfApplicability) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (s *StateOfApplicability) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM states_of_applicability WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -70,7 +70,7 @@ func (s *StateOfApplicability) AuthorizationAttributes(ctx context.Context, conn
|
||||
|
||||
func (s *StateOfApplicability) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
stateOfApplicabilityID gid.GID,
|
||||
) error {
|
||||
@@ -117,7 +117,7 @@ LIMIT 1;
|
||||
|
||||
func (s *StatesOfApplicability) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[StateOfApplicabilityOrderField],
|
||||
@@ -164,7 +164,7 @@ WHERE
|
||||
|
||||
func (s *StatesOfApplicability) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *StateOfApplicabilityFilter,
|
||||
@@ -198,7 +198,7 @@ WHERE
|
||||
|
||||
func (s *StateOfApplicability) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -255,7 +255,7 @@ VALUES (
|
||||
|
||||
func (s *StateOfApplicability) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -299,7 +299,7 @@ WHERE
|
||||
|
||||
func (s *StateOfApplicability) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -327,7 +327,7 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (soas StatesOfApplicability) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
func (soas StatesOfApplicability) Snapshot(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
if err := soas.insertStateOfApplicabilitySnapshots(ctx, conn, scope, organizationID, snapshotID); err != nil {
|
||||
return fmt.Errorf("cannot insert state_of_applicability snapshots: %w", err)
|
||||
}
|
||||
@@ -341,7 +341,7 @@ func (soas StatesOfApplicability) Snapshot(ctx context.Context, conn pg.Conn, sc
|
||||
|
||||
func (soas StatesOfApplicability) insertStateOfApplicabilitySnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
@@ -395,7 +395,7 @@ WHERE
|
||||
|
||||
func (soas StatesOfApplicability) insertStateOfApplicabilityControlSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -64,7 +64,7 @@ func (t Task) CursorKey(orderBy TaskOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (t *Task) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (t *Task) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM tasks WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -80,7 +80,7 @@ func (t *Task) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[s
|
||||
|
||||
func (t *Task) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
taskID gid.GID,
|
||||
) error {
|
||||
@@ -135,7 +135,7 @@ LIMIT 1;
|
||||
|
||||
func (t *Tasks) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
taskIDs []gid.GID,
|
||||
) error {
|
||||
@@ -185,7 +185,7 @@ WHERE
|
||||
|
||||
func (t *Task) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -265,7 +265,7 @@ RETURNING rank, priority_rank;
|
||||
|
||||
func (t *Task) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -365,7 +365,7 @@ RETURNING
|
||||
|
||||
func (t *Tasks) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -397,7 +397,7 @@ func (t *Tasks) CountByOrganizationID(
|
||||
|
||||
func (t *Tasks) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[TaskOrderField],
|
||||
@@ -449,7 +449,7 @@ func (t *Tasks) LoadByOrganizationID(
|
||||
|
||||
func (t *Tasks) CountByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -481,7 +481,7 @@ WHERE
|
||||
|
||||
func (t *Tasks) LoadByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
cursor *page.Cursor[TaskOrderField],
|
||||
@@ -533,7 +533,7 @@ WHERE
|
||||
|
||||
func (t *Task) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -574,7 +574,7 @@ WHERE %s
|
||||
|
||||
func (t *Task) NextRankForStatePriority(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -613,7 +613,7 @@ WHERE
|
||||
|
||||
func (t *Task) UpdateRank(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -668,7 +668,7 @@ WHERE %s
|
||||
|
||||
func (t *Task) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -34,7 +34,7 @@ type Token struct {
|
||||
|
||||
func (t *Token) LoadByHashedValueForUpdate(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
hashedValue []byte,
|
||||
) error {
|
||||
q := `
|
||||
@@ -72,7 +72,7 @@ FOR UPDATE;
|
||||
|
||||
func (t *Token) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
INSERT INTO iam_tokens(
|
||||
@@ -109,7 +109,7 @@ INSERT INTO iam_tokens(
|
||||
|
||||
func (t *Token) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
DELETE FROM iam_tokens
|
||||
|
||||
@@ -56,7 +56,7 @@ func (tia *TransferImpactAssessment) CursorKey(field TransferImpactAssessmentOrd
|
||||
panic(fmt.Sprintf("unsupported order by: %s", field))
|
||||
}
|
||||
|
||||
func (tia *TransferImpactAssessment) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (tia *TransferImpactAssessment) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM processing_activity_transfer_impact_assessments WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -73,7 +73,7 @@ func (tia *TransferImpactAssessment) AuthorizationAttributes(ctx context.Context
|
||||
|
||||
func (tias *TransferImpactAssessments) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *TransferImpactAssessmentFilter,
|
||||
@@ -108,7 +108,7 @@ WHERE
|
||||
|
||||
func (tias *TransferImpactAssessments) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[TransferImpactAssessmentOrderField],
|
||||
@@ -161,7 +161,7 @@ WHERE
|
||||
|
||||
func (tias *TransferImpactAssessments) LoadAllByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *TransferImpactAssessmentFilter,
|
||||
@@ -211,7 +211,7 @@ WHERE
|
||||
|
||||
func (tia *TransferImpactAssessment) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
tiaID gid.GID,
|
||||
) error {
|
||||
@@ -262,7 +262,7 @@ LIMIT 1;
|
||||
|
||||
func (tia *TransferImpactAssessment) LoadByProcessingActivityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
processingActivityID gid.GID,
|
||||
) error {
|
||||
@@ -313,7 +313,7 @@ LIMIT 1;
|
||||
|
||||
func (tia *TransferImpactAssessment) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -375,7 +375,7 @@ INSERT INTO processing_activity_transfer_impact_assessments (
|
||||
|
||||
func (tia *TransferImpactAssessment) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -414,7 +414,7 @@ WHERE
|
||||
|
||||
func (tia *TransferImpactAssessment) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -439,7 +439,7 @@ WHERE
|
||||
|
||||
func (tias TransferImpactAssessments) InsertProcessingActivitySnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -56,7 +56,7 @@ func (tc *TrustCenter) CursorKey(orderBy TrustCenterOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (tc *TrustCenter) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (tc *TrustCenter) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM trust_centers WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -72,7 +72,7 @@ func (tc *TrustCenter) AuthorizationAttributes(ctx context.Context, conn pg.Conn
|
||||
|
||||
func (tc *TrustCenter) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterID gid.GID,
|
||||
) error {
|
||||
@@ -124,7 +124,7 @@ LIMIT 1;
|
||||
|
||||
func (tc *TrustCenter) LoadByMailingListID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
mailingListID gid.GID,
|
||||
) error {
|
||||
@@ -176,7 +176,7 @@ LIMIT 1;
|
||||
|
||||
func (tc *TrustCenter) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) error {
|
||||
@@ -229,7 +229,7 @@ LIMIT 1;
|
||||
// Tenant id scope is not applied because we want to access trust centers by slug across all tenants for public access.
|
||||
func (tc *TrustCenter) LoadBySlug(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
slug string,
|
||||
) error {
|
||||
q := `
|
||||
@@ -276,7 +276,7 @@ LIMIT 1;
|
||||
|
||||
func (tc *TrustCenter) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -340,7 +340,7 @@ INSERT INTO trust_centers (
|
||||
|
||||
func (tc *TrustCenter) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -52,7 +52,7 @@ func (tca *TrustCenterAccess) CursorKey(orderBy TrustCenterAccessOrderField) pag
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (tca *TrustCenterAccess) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (tca *TrustCenterAccess) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM trust_center_accesses WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -68,7 +68,7 @@ func (tca *TrustCenterAccess) AuthorizationAttributes(ctx context.Context, conn
|
||||
|
||||
func (tca *TrustCenterAccess) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
accessID gid.GID,
|
||||
) error {
|
||||
@@ -116,7 +116,7 @@ LIMIT 1;
|
||||
|
||||
func (tca *TrustCenterAccess) LoadByTrustCenterIDAndIdentityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterID gid.GID,
|
||||
identityID gid.GID,
|
||||
@@ -169,7 +169,7 @@ LIMIT 1;
|
||||
|
||||
func (tca *TrustCenterAccess) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -221,7 +221,7 @@ INSERT INTO trust_center_accesses (
|
||||
|
||||
func (tca *TrustCenterAccess) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -252,7 +252,7 @@ WHERE
|
||||
|
||||
func (tca *TrustCenterAccess) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -279,7 +279,7 @@ WHERE
|
||||
|
||||
func (tcas *TrustCenterAccesses) LoadByTrustCenterID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterID gid.GID,
|
||||
cursor *page.Cursor[TrustCenterAccessOrderField],
|
||||
|
||||
@@ -53,7 +53,7 @@ func (tcda *TrustCenterDocumentAccess) CursorKey(orderBy TrustCenterDocumentAcce
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (tcda *TrustCenterDocumentAccess) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (tcda *TrustCenterDocumentAccess) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM trust_center_document_accesses WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -69,7 +69,7 @@ func (tcda *TrustCenterDocumentAccess) AuthorizationAttributes(ctx context.Conte
|
||||
|
||||
func (tcda *TrustCenterDocumentAccess) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
accessID gid.GID,
|
||||
) error {
|
||||
@@ -117,7 +117,7 @@ LIMIT 1;
|
||||
|
||||
func (tcda *TrustCenterDocumentAccess) LoadByTrustCenterAccessIDAndDocumentID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
documentID gid.GID,
|
||||
@@ -171,7 +171,7 @@ LIMIT 1;
|
||||
|
||||
func (tcda *TrustCenterDocumentAccess) LoadByTrustCenterAccessIDAndReportID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
reportID gid.GID,
|
||||
@@ -225,7 +225,7 @@ LIMIT 1;
|
||||
|
||||
func (tcda *TrustCenterDocumentAccess) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -288,7 +288,7 @@ INSERT INTO trust_center_document_accesses (
|
||||
|
||||
func (tcda *TrustCenterDocumentAccess) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -319,7 +319,7 @@ WHERE
|
||||
|
||||
func (tcda *TrustCenterDocumentAccess) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -346,7 +346,7 @@ WHERE
|
||||
|
||||
func (tcdas *TrustCenterDocumentAccesses) CountByTrustCenterAccessID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -379,7 +379,7 @@ WHERE
|
||||
|
||||
func (tcdas *TrustCenterDocumentAccesses) CountPendingRequestByTrustCenterAccessID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -413,7 +413,7 @@ WHERE
|
||||
|
||||
func (tcdas *TrustCenterDocumentAccesses) CountActiveByTrustCenterAccessID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -447,7 +447,7 @@ WHERE
|
||||
|
||||
func (tcdas *TrustCenterDocumentAccesses) LoadAvailableByTrustCenterAccessID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
cursor *page.Cursor[TrustCenterDocumentAccessOrderField],
|
||||
@@ -569,7 +569,7 @@ WHERE %s
|
||||
|
||||
func (tcdas *TrustCenterDocumentAccesses) LoadAllByTrustCenterAccessID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
) error {
|
||||
@@ -616,7 +616,7 @@ ORDER BY id ASC
|
||||
|
||||
func GrantByDocumentIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
documentIDs []gid.GID,
|
||||
@@ -650,7 +650,7 @@ WHERE
|
||||
|
||||
func RejectOrRevokeByDocumentIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
documentIDs []gid.GID,
|
||||
@@ -689,7 +689,7 @@ WHERE
|
||||
|
||||
func GrantByReportIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
reportIDs []gid.GID,
|
||||
@@ -723,7 +723,7 @@ WHERE
|
||||
|
||||
func RejectOrRevokeByReportIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
reportIDs []gid.GID,
|
||||
@@ -767,7 +767,7 @@ type MergeTrustCenterDocumentAccessesData struct {
|
||||
|
||||
func (tcdas TrustCenterDocumentAccesses) MergeDocumentAccesses(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
trustCenterAccessID gid.GID,
|
||||
@@ -840,7 +840,7 @@ WHEN NOT MATCHED
|
||||
|
||||
func (tcdas TrustCenterDocumentAccesses) BulkInsertDocumentAccesses(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -902,7 +902,7 @@ ON CONFLICT DO NOTHING
|
||||
|
||||
func (tcdas TrustCenterDocumentAccesses) MergeReportAccesses(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
trustCenterAccessID gid.GID,
|
||||
@@ -975,7 +975,7 @@ WHEN NOT MATCHED
|
||||
|
||||
func (tcdas TrustCenterDocumentAccesses) BulkInsertReportAccesses(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
organizationID gid.GID,
|
||||
@@ -1037,7 +1037,7 @@ ON CONFLICT DO NOTHING
|
||||
|
||||
func (tcda *TrustCenterDocumentAccess) LoadByTrustCenterAccessIDAndTrustCenterFileID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
trustCenterFileID gid.GID,
|
||||
@@ -1091,7 +1091,7 @@ LIMIT 1;
|
||||
|
||||
func GrantByTrustCenterFileIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
trustCenterFileIDs []gid.GID,
|
||||
@@ -1125,7 +1125,7 @@ WHERE
|
||||
|
||||
func RejectOrRevokeByTrustCenterFileIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
trustCenterFileIDs []gid.GID,
|
||||
@@ -1164,7 +1164,7 @@ WHERE
|
||||
|
||||
func (tcdas TrustCenterDocumentAccesses) MergeTrustCenterFileAccesses(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
trustCenterAccessID gid.GID,
|
||||
@@ -1237,7 +1237,7 @@ WHEN NOT MATCHED
|
||||
|
||||
func (tcdas TrustCenterDocumentAccesses) BulkInsertTrustCenterFileAccesses(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterAccessID gid.GID,
|
||||
organizationID gid.GID,
|
||||
|
||||
@@ -54,7 +54,7 @@ func (t TrustCenterFile) CursorKey(orderBy TrustCenterFileOrderField) page.Curso
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (t *TrustCenterFile) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (t *TrustCenterFile) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM trust_center_files WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -70,7 +70,7 @@ func (t *TrustCenterFile) AuthorizationAttributes(ctx context.Context, conn pg.C
|
||||
|
||||
func (t *TrustCenterFile) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterFileID gid.GID,
|
||||
) error {
|
||||
@@ -113,7 +113,7 @@ LIMIT 1;
|
||||
|
||||
func (f *TrustCenterFiles) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterFileIDs []gid.GID,
|
||||
) error {
|
||||
@@ -157,7 +157,7 @@ WHERE
|
||||
|
||||
func (t TrustCenterFile) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -208,7 +208,7 @@ VALUES (
|
||||
|
||||
func (t *TrustCenterFile) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -260,7 +260,7 @@ RETURNING
|
||||
|
||||
func (t *TrustCenterFile) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -286,7 +286,7 @@ WHERE
|
||||
|
||||
func (t *TrustCenterFiles) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[TrustCenterFileOrderField],
|
||||
@@ -335,7 +335,7 @@ WHERE
|
||||
|
||||
func (t *TrustCenterFiles) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -365,7 +365,7 @@ WHERE
|
||||
|
||||
func (t *TrustCenterFiles) LoadAllByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *TrustCenterFileFilter,
|
||||
|
||||
@@ -59,7 +59,7 @@ func (t TrustCenterReference) CursorKey(orderBy TrustCenterReferenceOrderField)
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (t *TrustCenterReference) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (t *TrustCenterReference) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM trust_center_references WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -75,7 +75,7 @@ func (t *TrustCenterReference) AuthorizationAttributes(ctx context.Context, conn
|
||||
|
||||
func (t *TrustCenterReference) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterReferenceID gid.GID,
|
||||
) error {
|
||||
@@ -120,7 +120,7 @@ LIMIT 1;
|
||||
|
||||
func (t *TrustCenterReference) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -183,7 +183,7 @@ RETURNING rank;
|
||||
|
||||
func (t *TrustCenterReference) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -225,7 +225,7 @@ WHERE
|
||||
|
||||
func (t *TrustCenterReference) UpdateRank(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -275,7 +275,7 @@ WHERE %s
|
||||
|
||||
func (t *TrustCenterReference) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -301,7 +301,7 @@ WHERE
|
||||
|
||||
func (t *TrustCenterReferences) LoadByTrustCenterID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterID gid.GID,
|
||||
cursor *page.Cursor[TrustCenterReferenceOrderField],
|
||||
@@ -349,7 +349,7 @@ WHERE
|
||||
|
||||
func (t *TrustCenterReferences) CountByTrustCenterID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
trustCenterID gid.GID,
|
||||
) (int, error) {
|
||||
|
||||
@@ -61,7 +61,7 @@ type (
|
||||
Vendors []*Vendor
|
||||
|
||||
VendorSnapshotter interface {
|
||||
InsertVendorSnapshots(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
InsertVendorSnapshots(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
}
|
||||
)
|
||||
|
||||
@@ -78,7 +78,7 @@ func (v Vendor) CursorKey(orderBy VendorOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (v *Vendor) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (v *Vendor) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM vendors WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -94,7 +94,7 @@ func (v *Vendor) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map
|
||||
|
||||
func (v *Vendor) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
) error {
|
||||
@@ -162,7 +162,7 @@ LIMIT 1;
|
||||
|
||||
func (v *Vendors) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorIDs []gid.GID,
|
||||
) error {
|
||||
@@ -224,7 +224,7 @@ WHERE
|
||||
|
||||
func (v Vendor) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -324,7 +324,7 @@ VALUES (
|
||||
|
||||
func (v Vendor) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -342,7 +342,7 @@ DELETE FROM vendors WHERE %s AND id = @vendor_id
|
||||
|
||||
func (v *Vendors) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *VendorFilter,
|
||||
@@ -377,7 +377,7 @@ WHERE
|
||||
|
||||
func (v *Vendors) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[VendorOrderField],
|
||||
@@ -444,7 +444,7 @@ WHERE
|
||||
|
||||
func (v *Vendor) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -509,7 +509,7 @@ WHERE %s
|
||||
|
||||
func (v Vendor) ExpireNonExpiredRiskAssessments(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
now := time.Now()
|
||||
@@ -543,7 +543,7 @@ func (v Vendor) ExpireNonExpiredRiskAssessments(
|
||||
|
||||
func (v *Vendors) CountByAssetID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
assetID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -582,7 +582,7 @@ WHERE %s
|
||||
|
||||
func (v *Vendors) LoadByAssetID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
assetID gid.GID,
|
||||
cursor *page.Cursor[VendorOrderField],
|
||||
@@ -680,7 +680,7 @@ WHERE %s
|
||||
|
||||
func (v *Vendors) CountByDatumID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
datumID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -719,7 +719,7 @@ WHERE %s
|
||||
|
||||
func (vs *Vendors) LoadByDatumID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
datumID gid.GID,
|
||||
cursor *page.Cursor[VendorOrderField],
|
||||
@@ -817,7 +817,7 @@ WHERE %s
|
||||
|
||||
func (v *Vendors) LoadByProcessingActivityID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
processingActivityID gid.GID,
|
||||
cursor *page.Cursor[VendorOrderField],
|
||||
@@ -915,7 +915,7 @@ WHERE %s
|
||||
|
||||
func (v *Vendors) LoadAllByProcessingActivities(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *ProcessingActivityFilter,
|
||||
@@ -983,7 +983,7 @@ ORDER BY
|
||||
|
||||
func (d Vendors) InsertDataSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
@@ -1085,7 +1085,7 @@ FROM source_vendors v
|
||||
|
||||
func (vs Vendors) InsertAssetSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
@@ -1187,7 +1187,7 @@ FROM source_vendors v
|
||||
|
||||
func (vs Vendors) InsertProcessingActivitySnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
@@ -1287,7 +1287,7 @@ FROM source_vendors v
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v Vendors) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
func (v Vendors) Snapshot(ctx context.Context, conn pg.Tx, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||
for _, snapshotter := range []VendorSnapshotter{
|
||||
Vendors{},
|
||||
VendorServices{},
|
||||
@@ -1307,7 +1307,7 @@ func (v Vendors) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organ
|
||||
|
||||
func (v Vendors) InsertVendorSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -56,7 +56,7 @@ func (v VendorBusinessAssociateAgreement) CursorKey(orderBy VendorBusinessAssoci
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (vbaa *VendorBusinessAssociateAgreement) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (vbaa *VendorBusinessAssociateAgreement) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM vendor_business_associate_agreements WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -72,7 +72,7 @@ func (vbaa *VendorBusinessAssociateAgreement) AuthorizationAttributes(ctx contex
|
||||
|
||||
func (vbaa *VendorBusinessAssociateAgreement) LoadByVendorID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
) error {
|
||||
@@ -118,7 +118,7 @@ LIMIT 1;
|
||||
|
||||
func (vbaa *VendorBusinessAssociateAgreement) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorBusinessAssociateAgreementID gid.GID,
|
||||
) error {
|
||||
@@ -164,7 +164,7 @@ LIMIT 1;
|
||||
|
||||
func (vbaa *VendorBusinessAssociateAgreement) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -202,7 +202,7 @@ WHERE
|
||||
|
||||
func (vbaa *VendorBusinessAssociateAgreement) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -271,7 +271,7 @@ ON CONFLICT (organization_id, vendor_id) DO UPDATE SET
|
||||
|
||||
func (vbaa *VendorBusinessAssociateAgreement) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -295,7 +295,7 @@ WHERE
|
||||
|
||||
func (vbaa *VendorBusinessAssociateAgreement) DeleteByVendorID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
) error {
|
||||
@@ -320,7 +320,7 @@ WHERE
|
||||
|
||||
func (v VendorBusinessAssociateAgreements) InsertVendorSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -56,7 +56,7 @@ func (c VendorComplianceReport) CursorKey(orderBy VendorComplianceReportOrderFie
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (v *VendorComplianceReport) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (v *VendorComplianceReport) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM vendor_compliance_reports WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -72,7 +72,7 @@ func (v *VendorComplianceReport) AuthorizationAttributes(ctx context.Context, co
|
||||
|
||||
func (vcs *VendorComplianceReports) LoadForVendorID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
cursor *page.Cursor[VendorComplianceReportOrderField],
|
||||
@@ -121,7 +121,7 @@ WHERE
|
||||
|
||||
func (vcr *VendorComplianceReport) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorComplianceReportID gid.GID,
|
||||
) error {
|
||||
@@ -168,7 +168,7 @@ LIMIT 1;
|
||||
|
||||
func (vcr *VendorComplianceReport) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -217,7 +217,7 @@ VALUES (
|
||||
|
||||
func (vcr *VendorComplianceReport) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -254,7 +254,7 @@ RETURNING report_file_id
|
||||
|
||||
func (vcrs VendorComplianceReports) InsertVendorSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -59,7 +59,7 @@ func (vc VendorContact) CursorKey(orderBy VendorContactOrderField) page.CursorKe
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (vc *VendorContact) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (vc *VendorContact) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM vendor_contacts WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -75,7 +75,7 @@ func (vc *VendorContact) AuthorizationAttributes(ctx context.Context, conn pg.Co
|
||||
|
||||
func (vc *VendorContact) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorContactID gid.GID,
|
||||
) error {
|
||||
@@ -127,7 +127,7 @@ LIMIT 1;
|
||||
|
||||
func (vc *VendorContacts) LoadByVendorID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
cursor *page.Cursor[VendorContactOrderField],
|
||||
@@ -178,7 +178,7 @@ WHERE
|
||||
|
||||
func (vc VendorContact) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -232,7 +232,7 @@ VALUES (
|
||||
|
||||
func (vc VendorContact) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -272,7 +272,7 @@ WHERE
|
||||
|
||||
func (vc VendorContact) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -299,7 +299,7 @@ WHERE
|
||||
|
||||
func (vc VendorContacts) InsertVendorSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -56,7 +56,7 @@ func (v VendorDataPrivacyAgreement) CursorKey(orderBy VendorDataPrivacyAgreement
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (vdpa *VendorDataPrivacyAgreement) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (vdpa *VendorDataPrivacyAgreement) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM vendor_data_privacy_agreements WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -72,7 +72,7 @@ func (vdpa *VendorDataPrivacyAgreement) AuthorizationAttributes(ctx context.Cont
|
||||
|
||||
func (vdpa *VendorDataPrivacyAgreement) LoadByVendorID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
) error {
|
||||
@@ -118,7 +118,7 @@ LIMIT 1;
|
||||
|
||||
func (vdpa *VendorDataPrivacyAgreement) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorDataPrivacyAgreementID gid.GID,
|
||||
) error {
|
||||
@@ -164,7 +164,7 @@ LIMIT 1;
|
||||
|
||||
func (vdpa *VendorDataPrivacyAgreement) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -202,7 +202,7 @@ WHERE
|
||||
|
||||
func (vdpa *VendorDataPrivacyAgreement) Upsert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -271,7 +271,7 @@ ON CONFLICT (organization_id, vendor_id) DO UPDATE SET
|
||||
|
||||
func (vdpa *VendorDataPrivacyAgreement) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -295,7 +295,7 @@ WHERE
|
||||
|
||||
func (vdpa *VendorDataPrivacyAgreement) DeleteByVendorID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
) error {
|
||||
@@ -319,7 +319,7 @@ WHERE
|
||||
|
||||
func (vdpa VendorDataPrivacyAgreements) InsertVendorSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -57,7 +57,7 @@ func (v VendorRiskAssessment) CursorKey(orderBy VendorRiskAssessmentOrderField)
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (v *VendorRiskAssessment) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (v *VendorRiskAssessment) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM vendor_risk_assessments WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -74,7 +74,7 @@ func (v *VendorRiskAssessment) AuthorizationAttributes(ctx context.Context, conn
|
||||
// Insert adds a new risk assessment to the database
|
||||
func (r VendorRiskAssessment) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -124,7 +124,7 @@ VALUES (
|
||||
// LoadByID loads a risk assessment by its ID
|
||||
func (r *VendorRiskAssessment) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
id gid.GID,
|
||||
) error {
|
||||
@@ -173,7 +173,7 @@ LIMIT 1;
|
||||
// LoadLatestByVendorID loads the most recent risk assessment for a vendor
|
||||
func (r *VendorRiskAssessment) LoadLatestByVendorID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
) error {
|
||||
@@ -224,7 +224,7 @@ LIMIT 1;
|
||||
// LoadByVendorID loads all risk assessments for a vendor, ordered by assessment date
|
||||
func (r *VendorRiskAssessments) LoadByVendorID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
cursor *page.Cursor[VendorRiskAssessmentOrderField],
|
||||
@@ -273,7 +273,7 @@ WHERE
|
||||
|
||||
func (v VendorRiskAssessments) InsertVendorSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -54,7 +54,7 @@ func (vs VendorService) CursorKey(orderBy VendorServiceOrderField) page.CursorKe
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (vs *VendorService) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (vs *VendorService) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM vendor_services WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -70,7 +70,7 @@ func (vs *VendorService) AuthorizationAttributes(ctx context.Context, conn pg.Co
|
||||
|
||||
func (vs *VendorService) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorServiceID gid.GID,
|
||||
) error {
|
||||
@@ -120,7 +120,7 @@ LIMIT 1;
|
||||
|
||||
func (vs *VendorServices) LoadByVendorID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
vendorID gid.GID,
|
||||
cursor *page.Cursor[VendorServiceOrderField],
|
||||
@@ -169,7 +169,7 @@ WHERE
|
||||
|
||||
func (vs VendorService) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -217,7 +217,7 @@ VALUES (
|
||||
|
||||
func (vs VendorService) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -253,7 +253,7 @@ WHERE
|
||||
|
||||
func (vs VendorService) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -280,7 +280,7 @@ WHERE
|
||||
|
||||
func (vs VendorServices) InsertVendorSnapshots(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
snapshotID gid.GID,
|
||||
|
||||
@@ -42,7 +42,7 @@ type (
|
||||
|
||||
func (w *WebhookData) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -83,7 +83,7 @@ VALUES (
|
||||
|
||||
func (w *WebhookData) LoadNextUnprocessedForUpdate(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
@@ -120,7 +120,7 @@ FOR UPDATE SKIP LOCKED
|
||||
|
||||
func (w *WebhookData) UpdateProcessedAt(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -51,7 +51,7 @@ func (w WebhookEvent) CursorKey(orderBy WebhookEventOrderField) page.CursorKey {
|
||||
|
||||
func (w *WebhookEvents) LoadBySubscriptionID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
webhookSubscriptionID gid.GID,
|
||||
cursor *page.Cursor[WebhookEventOrderField],
|
||||
@@ -93,7 +93,7 @@ WHERE
|
||||
|
||||
func (w *WebhookEvents) CountBySubscriptionID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
webhookSubscriptionID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -118,7 +118,7 @@ WHERE %s
|
||||
|
||||
func (w *WebhookEvent) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -162,7 +162,7 @@ VALUES (
|
||||
|
||||
func (w *WebhookEvent) UpdateStatus(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
@@ -85,7 +85,7 @@ func (w WebhookSubscription) CursorKey(orderBy WebhookSubscriptionOrderField) pa
|
||||
}
|
||||
|
||||
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||
func (w *WebhookSubscription) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||
func (w *WebhookSubscription) AuthorizationAttributes(ctx context.Context, conn pg.Querier) (map[string]string, error) {
|
||||
q := `SELECT organization_id FROM webhook_subscriptions WHERE id = $1 LIMIT 1;`
|
||||
|
||||
var organizationID gid.GID
|
||||
@@ -101,7 +101,7 @@ func (w *WebhookSubscription) AuthorizationAttributes(ctx context.Context, conn
|
||||
|
||||
func (w *WebhookSubscription) LoadByID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
webhookSubscriptionID gid.GID,
|
||||
) error {
|
||||
@@ -147,7 +147,7 @@ LIMIT 1;
|
||||
|
||||
func (w *WebhookSubscriptions) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[WebhookSubscriptionOrderField],
|
||||
@@ -190,7 +190,7 @@ WHERE
|
||||
|
||||
func (w *WebhookSubscriptions) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
) (int, error) {
|
||||
@@ -221,7 +221,7 @@ WHERE
|
||||
|
||||
func (w *WebhookSubscriptions) ExistsByOrganizationIDAndEventType(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
eventType WebhookEventType,
|
||||
@@ -253,7 +253,7 @@ SELECT EXISTS (
|
||||
|
||||
func (w *WebhookSubscription) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -301,7 +301,7 @@ VALUES (
|
||||
|
||||
func (w *WebhookSubscription) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
@@ -338,7 +338,7 @@ WHERE %s
|
||||
|
||||
func (w *WebhookSubscriptions) LoadMatchingByOrganizationIDAndEventType(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Querier,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
eventType WebhookEventType,
|
||||
@@ -383,7 +383,7 @@ WHERE
|
||||
|
||||
func (w *WebhookSubscription) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
conn pg.Tx,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
|
||||
Reference in New Issue
Block a user