Expose permission field on each core schema node implementation

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-12-30 17:35:52 +01:00
committed by Bryan Frimin
parent bf83e162d9
commit ca533ce7a7
15 changed files with 3974 additions and 240 deletions

View File

@@ -19,6 +19,7 @@ package console_v1
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"strings"
@@ -39,6 +40,7 @@ import (
"go.probo.inc/probo/pkg/securecookie"
connect_v1 "go.probo.inc/probo/pkg/server/api/connect/v1"
"go.probo.inc/probo/pkg/server/api/console/v1/schema"
"go.probo.inc/probo/pkg/server/api/console/v1/types"
"go.probo.inc/probo/pkg/server/gqlutils"
"go.probo.inc/probo/pkg/statelesstoken"
)
@@ -330,3 +332,38 @@ func (r *Resolver) MustAuthorize(ctx context.Context, entityID gid.GID, action i
panic(err)
}
}
func (r *Resolver) Permission(ctx context.Context, obj types.Node, action string) (bool, error) {
identity := connect_v1.IdentityFromContext(ctx)
err := r.iam.Authorizer.Authorize(
ctx,
iam.AuthorizeParams{
Principal: identity.ID,
Resource: obj.GetID(),
Action: action,
},
)
if err != nil {
var errInsufficientPermissions *iam.ErrInsufficientPermissions
if errors.As(err, &errInsufficientPermissions) {
graphql.AddError(
ctx,
&gqlerror.Error{
Path: graphql.GetPath(ctx),
Message: err.Error(),
Extensions: map[string]interface{}{
"code": "UNAUTHORIZED",
},
},
)
return false, nil
}
panic(fmt.Errorf("cannot authorize: %w", err))
}
return true, nil
}

View File

@@ -1494,6 +1494,8 @@ type TrustCenter implements Node {
before: CursorKey
orderBy: TrustCenterReferenceOrder
): TrustCenterReferenceConnection! @goField(forceResolver: true)
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Organization implements Node {
@@ -1712,6 +1714,8 @@ type Organization implements Node {
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type SlackConnection {
@@ -1743,6 +1747,8 @@ type People implements Node {
contractEndDate: Datetime
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Vendor implements Node {
@@ -1810,6 +1816,8 @@ type Vendor implements Node {
showOnTrustCenter: Boolean!
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type VendorComplianceReport implements Node {
@@ -1821,6 +1829,8 @@ type VendorComplianceReport implements Node {
file: File @goField(forceResolver: true)
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type VendorBusinessAssociateAgreement implements Node {
@@ -1833,6 +1843,8 @@ type VendorBusinessAssociateAgreement implements Node {
fileSize: BigInt!
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type VendorContact implements Node {
@@ -1844,6 +1856,8 @@ type VendorContact implements Node {
role: String
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type VendorService implements Node {
@@ -1853,6 +1867,8 @@ type VendorService implements Node {
description: String
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type VendorDataPrivacyAgreement implements Node {
@@ -1865,6 +1881,8 @@ type VendorDataPrivacyAgreement implements Node {
fileSize: BigInt!
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Framework implements Node {
@@ -1887,6 +1905,8 @@ type Framework implements Node {
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Control implements Node {
@@ -1954,6 +1974,8 @@ type Control implements Node {
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Measure implements Node {
@@ -1999,6 +2021,8 @@ type Measure implements Node {
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Task implements Node {
@@ -2023,6 +2047,8 @@ type Task implements Node {
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Evidence implements Node {
@@ -2039,6 +2065,8 @@ type Evidence implements Node {
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Document implements Node {
@@ -2072,6 +2100,8 @@ type Document implements Node {
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type SignableDocument
@@ -2107,6 +2137,8 @@ type Meeting implements Node {
organization: Organization! @goField(forceResolver: true)
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type StateOfApplicability implements Node {
@@ -2186,6 +2218,8 @@ type Risk implements Node {
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Audit implements Node {
@@ -2211,6 +2245,8 @@ type Audit implements Node {
trustCenterVisibility: TrustCenterVisibility!
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Nonconformity implements Node {
@@ -2229,6 +2265,8 @@ type Nonconformity implements Node {
effectivenessCheck: String
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Obligation implements Node {
@@ -2248,6 +2286,8 @@ type Obligation implements Node {
type: ObligationType!
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type ContinualImprovement implements Node {
@@ -2264,6 +2304,8 @@ type ContinualImprovement implements Node {
priority: ContinualImprovementPriority!
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type RightsRequest implements Node {
@@ -2317,6 +2359,8 @@ type ProcessingActivity implements Node {
@goField(forceResolver: true)
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type DataProtectionImpactAssessment implements Node {
@@ -2330,6 +2374,8 @@ type DataProtectionImpactAssessment implements Node {
residualRisk: DataProtectionImpactAssessmentResidualRisk
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type TransferImpactAssessment implements Node {
@@ -2343,6 +2389,8 @@ type TransferImpactAssessment implements Node {
supplementaryMeasures: String
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Snapshot implements Node {
@@ -2362,6 +2410,8 @@ type Snapshot implements Node {
): ControlConnection! @goField(forceResolver: true)
createdAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Report implements Node {
@@ -2374,6 +2424,8 @@ type Report implements Node {
createdAt: Datetime!
updatedAt: Datetime!
audit: Audit @goField(forceResolver: true)
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type Session {
@@ -2425,6 +2477,8 @@ type TrustCenterAccess implements Node {
before: CursorKey
orderBy: TrustCenterDocumentAccessOrder
): TrustCenterDocumentAccessConnection! @goField(forceResolver: true)
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type TrustCenterDocumentAccess
@@ -2471,6 +2525,8 @@ type TrustCenterReference implements Node {
rank: Int!
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type TrustCenterReferenceConnection
@@ -4557,6 +4613,8 @@ type VendorRiskAssessment implements Node {
notes: String
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
enum VendorRiskAssessmentOrderField
@@ -4679,6 +4737,8 @@ type DocumentVersionSignature implements Node {
requestedAt: Datetime!
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
input RequestSignatureInput {
@@ -4831,6 +4891,8 @@ type Asset implements Node {
organization: Organization! @goField(forceResolver: true)
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type AssetConnection
@@ -5100,6 +5162,8 @@ type CustomDomain implements Node {
dnsRecords: [DNSRecordInstruction!]!
createdAt: Datetime!
updatedAt: Datetime!
permission(action: String!): Boolean! @goField(forceResolver: true)
}
type DNSRecordInstruction {

File diff suppressed because it is too large Load Diff

View File

@@ -38,6 +38,7 @@ type Asset struct {
Organization *Organization `json:"organization"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Asset) IsNode() {}
@@ -66,6 +67,7 @@ type Audit struct {
TrustCenterVisibility coredata.TrustCenterVisibility `json:"trustCenterVisibility"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Audit) IsNode() {}
@@ -152,6 +154,7 @@ type ContinualImprovement struct {
Priority coredata.ContinualImprovementPriority `json:"priority"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (ContinualImprovement) IsNode() {}
@@ -184,6 +187,7 @@ type Control struct {
StateOfApplicabilityControls *StateOfApplicabilityControlConnection `json:"stateOfApplicabilityControls"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Control) IsNode() {}
@@ -716,6 +720,7 @@ type CustomDomain struct {
DNSRecords []*DNSRecordInstruction `json:"dnsRecords"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (CustomDomain) IsNode() {}
@@ -740,6 +745,7 @@ type DataProtectionImpactAssessment struct {
ResidualRisk *coredata.DataProtectionImpactAssessmentResidualRisk `json:"residualRisk,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (DataProtectionImpactAssessment) IsNode() {}
@@ -1140,6 +1146,7 @@ type Document struct {
Controls *ControlConnection `json:"controls"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Document) IsNode() {}
@@ -1177,6 +1184,7 @@ type DocumentVersionSignature struct {
RequestedAt time.Time `json:"requestedAt"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (DocumentVersionSignature) IsNode() {}
@@ -1213,6 +1221,7 @@ type Evidence struct {
Measure *Measure `json:"measure"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Evidence) IsNode() {}
@@ -1305,6 +1314,7 @@ type Framework struct {
DarkLogoURL *string `json:"darkLogoURL,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Framework) IsNode() {}
@@ -1380,6 +1390,7 @@ type Measure struct {
Controls *ControlConnection `json:"controls"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Measure) IsNode() {}
@@ -1404,6 +1415,7 @@ type Meeting struct {
Organization *Organization `json:"organization"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Meeting) IsNode() {}
@@ -1433,6 +1445,7 @@ type Nonconformity struct {
EffectivenessCheck *string `json:"effectivenessCheck,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Nonconformity) IsNode() {}
@@ -1464,6 +1477,7 @@ type Obligation struct {
Type coredata.ObligationType `json:"type"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Obligation) IsNode() {}
@@ -1515,6 +1529,7 @@ type Organization struct {
CustomDomain *CustomDomain `json:"customDomain,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Organization) IsNode() {}
@@ -1548,6 +1563,7 @@ type People struct {
ContractEndDate *time.Time `json:"contractEndDate,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (People) IsNode() {}
@@ -1591,6 +1607,7 @@ type ProcessingActivity struct {
TransferImpactAssessment *TransferImpactAssessment `json:"transferImpactAssessment,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (ProcessingActivity) IsNode() {}
@@ -1628,6 +1645,7 @@ type Report struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Audit *Audit `json:"audit,omitempty"`
Permission bool `json:"permission"`
}
func (Report) IsNode() {}
@@ -1697,6 +1715,7 @@ type Risk struct {
Obligations *ObligationConnection `json:"obligations"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Risk) IsNode() {}
@@ -1759,6 +1778,7 @@ type Snapshot struct {
Type coredata.SnapshotsType `json:"type"`
Controls *ControlConnection `json:"controls"`
CreatedAt time.Time `json:"createdAt"`
Permission bool `json:"permission"`
}
func (Snapshot) IsNode() {}
@@ -1822,6 +1842,7 @@ type Task struct {
Evidences *EvidenceConnection `json:"evidences"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Task) IsNode() {}
@@ -1843,6 +1864,7 @@ type TransferImpactAssessment struct {
SupplementaryMeasures *string `json:"supplementaryMeasures,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (TransferImpactAssessment) IsNode() {}
@@ -1867,6 +1889,7 @@ type TrustCenter struct {
Organization *Organization `json:"organization"`
Accesses *TrustCenterAccessConnection `json:"accesses"`
References *TrustCenterReferenceConnection `json:"references"`
Permission bool `json:"permission"`
}
func (TrustCenter) IsNode() {}
@@ -1884,6 +1907,7 @@ type TrustCenterAccess struct {
PendingRequestCount int `json:"pendingRequestCount"`
ActiveCount int `json:"activeCount"`
AvailableDocumentAccesses *TrustCenterDocumentAccessConnection `json:"availableDocumentAccesses"`
Permission bool `json:"permission"`
}
func (TrustCenterAccess) IsNode() {}
@@ -1944,6 +1968,7 @@ type TrustCenterReference struct {
Rank int `json:"rank"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (TrustCenterReference) IsNode() {}
@@ -2465,6 +2490,7 @@ type Vendor struct {
ShowOnTrustCenter bool `json:"showOnTrustCenter"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (Vendor) IsNode() {}
@@ -2480,6 +2506,7 @@ type VendorBusinessAssociateAgreement struct {
FileSize int64 `json:"fileSize"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (VendorBusinessAssociateAgreement) IsNode() {}
@@ -2494,6 +2521,7 @@ type VendorComplianceReport struct {
File *File `json:"file,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (VendorComplianceReport) IsNode() {}
@@ -2510,14 +2538,15 @@ type VendorComplianceReportEdge struct {
}
type VendorContact struct {
ID gid.GID `json:"id"`
Vendor *Vendor `json:"vendor"`
FullName *string `json:"fullName,omitempty"`
Email *mail.Addr `json:"email,omitempty"`
Phone *string `json:"phone,omitempty"`
Role *string `json:"role,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ID gid.GID `json:"id"`
Vendor *Vendor `json:"vendor"`
FullName *string `json:"fullName,omitempty"`
Email *mail.Addr `json:"email,omitempty"`
Phone *string `json:"phone,omitempty"`
Role *string `json:"role,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (VendorContact) IsNode() {}
@@ -2543,6 +2572,7 @@ type VendorDataPrivacyAgreement struct {
FileSize int64 `json:"fileSize"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (VendorDataPrivacyAgreement) IsNode() {}
@@ -2566,6 +2596,7 @@ type VendorRiskAssessment struct {
Notes *string `json:"notes,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (VendorRiskAssessment) IsNode() {}
@@ -2593,6 +2624,7 @@ type VendorService struct {
Description *string `json:"description,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permission bool `json:"permission"`
}
func (VendorService) IsNode() {}

View File

@@ -94,6 +94,11 @@ func (r *assetResolver) Organization(ctx context.Context, obj *types.Asset) (*ty
return types.NewOrganization(org), nil
}
// Permission is the resolver for the permission field.
func (r *assetResolver) Permission(ctx context.Context, obj *types.Asset, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *assetConnectionResolver) TotalCount(ctx context.Context, obj *types.AssetConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionAssetList)
@@ -222,6 +227,11 @@ func (r *auditResolver) Controls(ctx context.Context, obj *types.Audit, first *i
return types.NewControlConnection(page, r, obj.ID, controlFilter), nil
}
// Permission is the resolver for the permission field.
func (r *auditResolver) Permission(ctx context.Context, obj *types.Audit, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *auditConnectionResolver) TotalCount(ctx context.Context, obj *types.AuditConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionAuditList)
@@ -273,6 +283,11 @@ func (r *continualImprovementResolver) Owner(ctx context.Context, obj *types.Con
return types.NewPeople(people), nil
}
// Permission is the resolver for the permission field.
func (r *continualImprovementResolver) Permission(ctx context.Context, obj *types.ContinualImprovement, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *continualImprovementConnectionResolver) TotalCount(ctx context.Context, obj *types.ContinualImprovementConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionContinualImprovementList)
@@ -500,6 +515,11 @@ func (r *controlResolver) StateOfApplicabilityControls(ctx context.Context, obj
return types.NewStateOfApplicabilityControlConnection(p, r, obj.ID), nil
}
// Permission is the resolver for the permission field.
func (r *controlResolver) Permission(ctx context.Context, obj *types.Control, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *controlConnectionResolver) TotalCount(ctx context.Context, obj *types.ControlConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionControlList)
@@ -548,6 +568,11 @@ func (r *controlConnectionResolver) TotalCount(ctx context.Context, obj *types.C
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
}
// Permission is the resolver for the permission field.
func (r *customDomainResolver) Permission(ctx context.Context, obj *types.CustomDomain, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// ProcessingActivity is the resolver for the processingActivity field.
func (r *dataProtectionImpactAssessmentResolver) ProcessingActivity(ctx context.Context, obj *types.DataProtectionImpactAssessment) (*types.ProcessingActivity, error) {
r.MustAuthorize(ctx, obj.ID, probo.ActionProcessingActivityList)
@@ -589,6 +614,11 @@ func (r *dataProtectionImpactAssessmentResolver) Organization(ctx context.Contex
return types.NewOrganization(organization), nil
}
// Permission is the resolver for the permission field.
func (r *dataProtectionImpactAssessmentResolver) Permission(ctx context.Context, obj *types.DataProtectionImpactAssessment, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *dataProtectionImpactAssessmentConnectionResolver) TotalCount(ctx context.Context, obj *types.DataProtectionImpactAssessmentConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionDataProtectionImpactAssessmentList)
@@ -798,6 +828,11 @@ func (r *documentResolver) Controls(ctx context.Context, obj *types.Document, fi
return types.NewControlConnection(page, r, obj.ID, controlFilter), nil
}
// Permission is the resolver for the permission field.
func (r *documentResolver) Permission(ctx context.Context, obj *types.Document, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *documentConnectionResolver) TotalCount(ctx context.Context, obj *types.DocumentConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionDocumentList)
@@ -955,6 +990,11 @@ func (r *documentVersionSignatureResolver) SignedBy(ctx context.Context, obj *ty
return types.NewPeople(people), nil
}
// Permission is the resolver for the permission field.
func (r *documentVersionSignatureResolver) Permission(ctx context.Context, obj *types.DocumentVersionSignature, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// File is the resolver for the file field.
func (r *evidenceResolver) File(ctx context.Context, obj *types.Evidence) (*types.File, error) {
r.MustAuthorize(ctx, obj.ID, probo.ActionFileGet)
@@ -1019,6 +1059,11 @@ func (r *evidenceResolver) Measure(ctx context.Context, obj *types.Evidence) (*t
return types.NewMeasure(measure), nil
}
// Permission is the resolver for the permission field.
func (r *evidenceResolver) Permission(ctx context.Context, obj *types.Evidence, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *evidenceConnectionResolver) TotalCount(ctx context.Context, obj *types.EvidenceConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionEvidenceList)
@@ -1132,6 +1177,11 @@ func (r *frameworkResolver) DarkLogoURL(ctx context.Context, obj *types.Framewor
return prb.Frameworks.GenerateDarkLogoURL(ctx, obj.ID, 1*time.Hour)
}
// Permission is the resolver for the permission field.
func (r *frameworkResolver) Permission(ctx context.Context, obj *types.Framework, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *frameworkConnectionResolver) TotalCount(ctx context.Context, obj *types.FrameworkConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionFrameworkList)
@@ -1274,6 +1324,11 @@ func (r *measureResolver) Controls(ctx context.Context, obj *types.Measure, firs
return types.NewControlConnection(page, r, obj.ID, controlFilter), nil
}
// Permission is the resolver for the permission field.
func (r *measureResolver) Permission(ctx context.Context, obj *types.Measure, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *measureConnectionResolver) TotalCount(ctx context.Context, obj *types.MeasureConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionMeasureList)
@@ -1353,6 +1408,11 @@ func (r *meetingResolver) Organization(ctx context.Context, obj *types.Meeting)
return types.NewOrganization(organization), nil
}
// Permission is the resolver for the permission field.
func (r *meetingResolver) Permission(ctx context.Context, obj *types.Meeting, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *meetingConnectionResolver) TotalCount(ctx context.Context, obj *types.MeetingConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionMeetingList)
@@ -4748,6 +4808,11 @@ func (r *nonconformityResolver) Owner(ctx context.Context, obj *types.Nonconform
return types.NewPeople(people), nil
}
// Permission is the resolver for the permission field.
func (r *nonconformityResolver) Permission(ctx context.Context, obj *types.Nonconformity, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *nonconformityConnectionResolver) TotalCount(ctx context.Context, obj *types.NonconformityConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionNonconformityList)
@@ -4810,6 +4875,11 @@ func (r *obligationResolver) Owner(ctx context.Context, obj *types.Obligation) (
return types.NewPeople(people), nil
}
// Permission is the resolver for the permission field.
func (r *obligationResolver) Permission(ctx context.Context, obj *types.Obligation, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *obligationConnectionResolver) TotalCount(ctx context.Context, obj *types.ObligationConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionObligationList)
@@ -5645,6 +5715,16 @@ func (r *organizationResolver) CustomDomain(ctx context.Context, obj *types.Orga
return types.NewCustomDomain(domain, r.customDomainCname), nil
}
// Permission is the resolver for the permission field.
func (r *organizationResolver) Permission(ctx context.Context, obj *types.Organization, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// Permission is the resolver for the permission field.
func (r *peopleResolver) Permission(ctx context.Context, obj *types.People, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *peopleConnectionResolver) TotalCount(ctx context.Context, obj *types.PeopleConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionPeopleList)
@@ -5772,6 +5852,11 @@ func (r *processingActivityResolver) TransferImpactAssessment(ctx context.Contex
return types.NewTransferImpactAssessment(tia), nil
}
// Permission is the resolver for the permission field.
func (r *processingActivityResolver) Permission(ctx context.Context, obj *types.ProcessingActivity, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *processingActivityConnectionResolver) TotalCount(ctx context.Context, obj *types.ProcessingActivityConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionProcessingActivityList)
@@ -6153,6 +6238,11 @@ func (r *reportResolver) Audit(ctx context.Context, obj *types.Report) (*types.A
return types.NewAudit(audit), nil
}
// Permission is the resolver for the permission field.
func (r *reportResolver) Permission(ctx context.Context, obj *types.Report, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// Organization is the resolver for the organization field.
func (r *rightsRequestResolver) Organization(ctx context.Context, obj *types.RightsRequest) (*types.Organization, error) {
r.MustAuthorize(ctx, obj.ID, iam.ActionGetOrganization)
@@ -6367,6 +6457,11 @@ func (r *riskResolver) Obligations(ctx context.Context, obj *types.Risk, first *
return types.NewObligationConnection(page, r, obj.ID, filter), nil
}
// Permission is the resolver for the permission field.
func (r *riskResolver) Permission(ctx context.Context, obj *types.Risk, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *riskConnectionResolver) TotalCount(ctx context.Context, obj *types.RiskConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionRiskList)
@@ -6496,6 +6591,11 @@ func (r *snapshotResolver) Controls(ctx context.Context, obj *types.Snapshot, fi
return types.NewControlConnection(page, r, obj.ID, controlFilter), nil
}
// Permission is the resolver for the permission field.
func (r *snapshotResolver) Permission(ctx context.Context, obj *types.Snapshot, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *snapshotConnectionResolver) TotalCount(ctx context.Context, obj *types.SnapshotConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionSnapshotList)
@@ -6731,6 +6831,11 @@ func (r *taskResolver) Evidences(ctx context.Context, obj *types.Task, first *in
return types.NewEvidenceConnection(page, r, obj.ID), nil
}
// Permission is the resolver for the permission field.
func (r *taskResolver) Permission(ctx context.Context, obj *types.Task, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *taskConnectionResolver) TotalCount(ctx context.Context, obj *types.TaskConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionTaskList)
@@ -6787,6 +6892,11 @@ func (r *transferImpactAssessmentResolver) Organization(ctx context.Context, obj
return types.NewOrganization(organization), nil
}
// Permission is the resolver for the permission field.
func (r *transferImpactAssessmentResolver) Permission(ctx context.Context, obj *types.TransferImpactAssessment, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *transferImpactAssessmentConnectionResolver) TotalCount(ctx context.Context, obj *types.TransferImpactAssessmentConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionTransferImpactAssessmentList)
@@ -6896,6 +7006,11 @@ func (r *trustCenterResolver) References(ctx context.Context, obj *types.TrustCe
return types.NewTrustCenterReferenceConnection(result, obj.ID), nil
}
// Permission is the resolver for the permission field.
func (r *trustCenterResolver) Permission(ctx context.Context, obj *types.TrustCenter, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// PendingRequestCount is the resolver for the pendingRequestCount field.
func (r *trustCenterAccessResolver) PendingRequestCount(ctx context.Context, obj *types.TrustCenterAccess) (int, error) {
r.MustAuthorize(ctx, obj.ID, probo.ActionTrustCenterAccessGet)
@@ -6950,6 +7065,11 @@ func (r *trustCenterAccessResolver) AvailableDocumentAccesses(ctx context.Contex
return types.NewTrustCenterDocumentAccessConnection(result, obj, obj.ID), nil
}
// Permission is the resolver for the permission field.
func (r *trustCenterAccessResolver) Permission(ctx context.Context, obj *types.TrustCenterAccess, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// Document is the resolver for the document field.
func (r *trustCenterDocumentAccessResolver) Document(ctx context.Context, obj *types.TrustCenterDocumentAccess) (*types.Document, error) {
r.MustAuthorize(ctx, obj.ID, probo.ActionDocumentGet)
@@ -7086,6 +7206,11 @@ func (r *trustCenterReferenceResolver) LogoURL(ctx context.Context, obj *types.T
return fileURL, nil
}
// Permission is the resolver for the permission field.
func (r *trustCenterReferenceResolver) Permission(ctx context.Context, obj *types.TrustCenterReference, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *trustCenterReferenceConnectionResolver) TotalCount(ctx context.Context, obj *types.TrustCenterReferenceConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionTrustCenterReferenceList)
@@ -7324,6 +7449,11 @@ func (r *vendorResolver) SecurityOwner(ctx context.Context, obj *types.Vendor) (
return types.NewPeople(people), nil
}
// Permission is the resolver for the permission field.
func (r *vendorResolver) Permission(ctx context.Context, obj *types.Vendor, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// Vendor is the resolver for the vendor field.
func (r *vendorBusinessAssociateAgreementResolver) Vendor(ctx context.Context, obj *types.VendorBusinessAssociateAgreement) (*types.Vendor, error) {
r.MustAuthorize(ctx, obj.ID, probo.ActionVendorGet)
@@ -7356,6 +7486,11 @@ func (r *vendorBusinessAssociateAgreementResolver) FileURL(ctx context.Context,
return fileURL, nil
}
// Permission is the resolver for the permission field.
func (r *vendorBusinessAssociateAgreementResolver) Permission(ctx context.Context, obj *types.VendorBusinessAssociateAgreement, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// Vendor is the resolver for the vendor field.
func (r *vendorComplianceReportResolver) Vendor(ctx context.Context, obj *types.VendorComplianceReport) (*types.Vendor, error) {
r.MustAuthorize(ctx, obj.ID, probo.ActionVendorGet)
@@ -7401,6 +7536,11 @@ func (r *vendorComplianceReportResolver) File(ctx context.Context, obj *types.Ve
return types.NewFile(file), nil
}
// Permission is the resolver for the permission field.
func (r *vendorComplianceReportResolver) Permission(ctx context.Context, obj *types.VendorComplianceReport, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// TotalCount is the resolver for the totalCount field.
func (r *vendorConnectionResolver) TotalCount(ctx context.Context, obj *types.VendorConnection) (int, error) {
r.MustAuthorize(ctx, obj.ParentID, probo.ActionVendorList)
@@ -7455,6 +7595,11 @@ func (r *vendorContactResolver) Vendor(ctx context.Context, obj *types.VendorCon
return types.NewVendor(vendor), nil
}
// Permission is the resolver for the permission field.
func (r *vendorContactResolver) Permission(ctx context.Context, obj *types.VendorContact, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// Vendor is the resolver for the vendor field.
func (r *vendorDataPrivacyAgreementResolver) Vendor(ctx context.Context, obj *types.VendorDataPrivacyAgreement) (*types.Vendor, error) {
r.MustAuthorize(ctx, obj.ID, probo.ActionVendorGet)
@@ -7487,6 +7632,11 @@ func (r *vendorDataPrivacyAgreementResolver) FileURL(ctx context.Context, obj *t
return fileURL, nil
}
// Permission is the resolver for the permission field.
func (r *vendorDataPrivacyAgreementResolver) Permission(ctx context.Context, obj *types.VendorDataPrivacyAgreement, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// Vendor is the resolver for the vendor field.
func (r *vendorRiskAssessmentResolver) Vendor(ctx context.Context, obj *types.VendorRiskAssessment) (*types.Vendor, error) {
r.MustAuthorize(ctx, obj.ID, probo.ActionVendorGet)
@@ -7505,6 +7655,11 @@ func (r *vendorRiskAssessmentResolver) Vendor(ctx context.Context, obj *types.Ve
return types.NewVendor(vendor), nil
}
// Permission is the resolver for the permission field.
func (r *vendorRiskAssessmentResolver) Permission(ctx context.Context, obj *types.VendorRiskAssessment, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// Vendor is the resolver for the vendor field.
func (r *vendorServiceResolver) Vendor(ctx context.Context, obj *types.VendorService) (*types.Vendor, error) {
r.MustAuthorize(ctx, obj.ID, probo.ActionVendorGet)
@@ -7523,6 +7678,11 @@ func (r *vendorServiceResolver) Vendor(ctx context.Context, obj *types.VendorSer
return types.NewVendor(vendor), nil
}
// Permission is the resolver for the permission field.
func (r *vendorServiceResolver) Permission(ctx context.Context, obj *types.VendorService, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
}
// SignableDocuments is the resolver for the signableDocuments field.
func (r *viewerResolver) SignableDocuments(ctx context.Context, obj *types.Viewer, organizationID gid.GID, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentOrderBy) (*types.SignableDocumentConnection, error) {
r.MustAuthorize(ctx, organizationID, probo.ActionDocumentList)
@@ -7630,6 +7790,9 @@ func (r *Resolver) ControlConnection() schema.ControlConnectionResolver {
return &controlConnectionResolver{r}
}
// CustomDomain returns schema.CustomDomainResolver implementation.
func (r *Resolver) CustomDomain() schema.CustomDomainResolver { return &customDomainResolver{r} }
// DataProtectionImpactAssessment returns schema.DataProtectionImpactAssessmentResolver implementation.
func (r *Resolver) DataProtectionImpactAssessment() schema.DataProtectionImpactAssessmentResolver {
return &dataProtectionImpactAssessmentResolver{r}
@@ -7723,6 +7886,9 @@ func (r *Resolver) ObligationConnection() schema.ObligationConnectionResolver {
// Organization returns schema.OrganizationResolver implementation.
func (r *Resolver) Organization() schema.OrganizationResolver { return &organizationResolver{r} }
// People returns schema.PeopleResolver implementation.
func (r *Resolver) People() schema.PeopleResolver { return &peopleResolver{r} }
// PeopleConnection returns schema.PeopleConnectionResolver implementation.
func (r *Resolver) PeopleConnection() schema.PeopleConnectionResolver {
return &peopleConnectionResolver{r}
@@ -7885,6 +8051,7 @@ type continualImprovementResolver struct{ *Resolver }
type continualImprovementConnectionResolver struct{ *Resolver }
type controlResolver struct{ *Resolver }
type controlConnectionResolver struct{ *Resolver }
type customDomainResolver struct{ *Resolver }
type dataProtectionImpactAssessmentResolver struct{ *Resolver }
type dataProtectionImpactAssessmentConnectionResolver struct{ *Resolver }
type datumResolver struct{ *Resolver }
@@ -7908,6 +8075,7 @@ type nonconformityConnectionResolver struct{ *Resolver }
type obligationResolver struct{ *Resolver }
type obligationConnectionResolver struct{ *Resolver }
type organizationResolver struct{ *Resolver }
type peopleResolver struct{ *Resolver }
type peopleConnectionResolver struct{ *Resolver }
type processingActivityResolver struct{ *Resolver }
type processingActivityConnectionResolver struct{ *Resolver }