Rename GraphQL APIs to compliance portal

Update console, visitor, MCP, and Slack API
surfaces so schemas and resolvers use the
Compliance Portal naming consistently.

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-07-20 18:08:21 +02:00
parent 0f0f6643ad
commit 8773a54396
57 changed files with 1830 additions and 1833 deletions

View File

@@ -29,11 +29,11 @@ import (
"go.probo.inc/probo/pkg/server/gqlutils"
)
func NewCompliancePagePresenceMiddleware() func(next http.Handler) http.Handler {
func NewCompliancePortalPresenceMiddleware() func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
compliancePage := CompliancePageFromContext(r.Context())
compliancePage := CompliancePortalFromContext(r.Context())
if compliancePage == nil {
httpserver.RenderJSON(

View File

@@ -29,16 +29,16 @@ import (
type ctxKey struct{ name string }
var (
compliancePageKey = &ctxKey{name: "compliance_page"}
compliancePageBaseURLKey = &ctxKey{name: "compliance_page_base_url"}
compliancePortalKey = &ctxKey{name: "compliance_portal"}
compliancePortalBaseURLKey = &ctxKey{name: "compliance_portal_base_url"}
)
func CompliancePageFromContext(ctx context.Context) *coredata.TrustCenter {
page, _ := ctx.Value(compliancePageKey).(*coredata.TrustCenter)
func CompliancePortalFromContext(ctx context.Context) *coredata.CompliancePortal {
page, _ := ctx.Value(compliancePortalKey).(*coredata.CompliancePortal)
return page
}
func CompliancePageBaseURLFromContext(ctx context.Context) *string {
page, _ := ctx.Value(compliancePageBaseURLKey).(*string)
func CompliancePortalBaseURLFromContext(ctx context.Context) *string {
page, _ := ctx.Value(compliancePortalBaseURLKey).(*string)
return page
}

View File

@@ -28,15 +28,15 @@ import (
)
type Handler struct {
trustService *visitor.Service
visitor *visitor.Service
}
func NewHandler(trustService *visitor.Service) *Handler {
return &Handler{trustService: trustService}
func NewHandler(visitorSvc *visitor.Service) *Handler {
return &Handler{visitor: visitorSvc}
}
func (h *Handler) HandleLLMsTxt(w http.ResponseWriter, r *http.Request) {
tc := CompliancePageFromContext(r.Context())
tc := CompliancePortalFromContext(r.Context())
if tc == nil {
http.Error(w, "not found", http.StatusNotFound)
return
@@ -46,19 +46,19 @@ func (h *Handler) HandleLLMsTxt(w http.ResponseWriter, r *http.Request) {
scope := coredata.NewScopeFromObjectID(tc.ID)
if err := h.trustService.RenderCompliancePageMarkdown(r.Context(), w, tc.ID, scope); err != nil {
if err := h.visitor.RenderCompliancePortalMarkdown(r.Context(), w, tc.ID, scope); err != nil {
http.Error(w, "internal server error", http.StatusInternalServerError)
}
}
func (h *Handler) HandleRobotsTxt(w http.ResponseWriter, r *http.Request) {
tc := CompliancePageFromContext(r.Context())
tc := CompliancePortalFromContext(r.Context())
if tc == nil {
http.Error(w, "not found", http.StatusNotFound)
return
}
baseURL := CompliancePageBaseURLFromContext(r.Context())
baseURL := CompliancePortalBaseURLFromContext(r.Context())
if baseURL == nil {
http.Error(w, "not found", http.StatusNotFound)
return
@@ -66,19 +66,19 @@ func (h *Handler) HandleRobotsTxt(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
if err := h.trustService.RenderRobotsTxt(r.Context(), w, tc.SearchEngineIndexing, *baseURL); err != nil {
if err := h.visitor.RenderRobotsTxt(r.Context(), w, tc.SearchEngineIndexing, *baseURL); err != nil {
http.Error(w, "internal server error", http.StatusInternalServerError)
}
}
func (h *Handler) HandleSitemap(w http.ResponseWriter, r *http.Request) {
tc := CompliancePageFromContext(r.Context())
tc := CompliancePortalFromContext(r.Context())
if tc == nil {
http.Error(w, "not found", http.StatusNotFound)
return
}
baseURL := CompliancePageBaseURLFromContext(r.Context())
baseURL := CompliancePortalBaseURLFromContext(r.Context())
if baseURL == nil {
http.Error(w, "not found", http.StatusNotFound)
return
@@ -88,7 +88,7 @@ func (h *Handler) HandleSitemap(w http.ResponseWriter, r *http.Request) {
scope := coredata.NewScopeFromObjectID(tc.ID)
if err := h.trustService.RenderSitemap(r.Context(), w, tc.ID, scope, *baseURL); err != nil {
if err := h.visitor.RenderSitemap(r.Context(), w, tc.ID, scope, *baseURL); err != nil {
http.Error(w, "internal server error", http.StatusInternalServerError)
}
}

View File

@@ -32,7 +32,7 @@ import (
"go.probo.inc/probo/pkg/server/gqlutils"
)
func NewMemberProvisioningMiddleware(trustSvc *visitor.Service, logger *log.Logger) func(next http.Handler) http.Handler {
func NewMemberProvisioningMiddleware(visitorSvc *visitor.Service, logger *log.Logger) func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
@@ -44,9 +44,9 @@ func NewMemberProvisioningMiddleware(trustSvc *visitor.Service, logger *log.Logg
return
}
compliancePage := CompliancePageFromContext(r.Context())
compliancePage := CompliancePortalFromContext(r.Context())
if _, err := trustSvc.ProvisionPortalMember(ctx, compliancePage.ID, identity.ID); err != nil {
if _, err := visitorSvc.ProvisionPortalMember(ctx, compliancePage.ID, identity.ID); err != nil {
logger.ErrorCtx(ctx, "cannot provision member", log.Error(err))
httpserver.RenderJSON(
w,

View File

@@ -34,7 +34,7 @@ import (
"go.probo.inc/probo/pkg/server/gqlutils"
)
func NewSNIMiddleware(trustSvc *visitor.Service) func(next http.Handler) http.Handler {
func NewSNIMiddleware(visitorSvc *visitor.Service) func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
@@ -44,7 +44,7 @@ func NewSNIMiddleware(trustSvc *visitor.Service) func(next http.Handler) http.Ha
return
}
compliancePage, err := trustSvc.GetPortalByDomainName(ctx, r.TLS.ServerName)
compliancePage, err := visitorSvc.GetPortalByDomainName(ctx, r.TLS.ServerName)
if err != nil {
if errors.Is(err, visitor.ErrPageNotFound) {
next.ServeHTTP(w, r)
@@ -68,7 +68,7 @@ func NewSNIMiddleware(trustSvc *visitor.Service) func(next http.Handler) http.Ha
// page is only ever served under a single origin. ACME HTTP-01
// challenges are handled upstream and never reach this middleware.
if !strings.HasPrefix(r.URL.Path, "/.well-known/") {
canonicalHost, err := trustSvc.GetPortalEffectiveCanonicalHost(ctx, compliancePage.ID)
canonicalHost, err := visitorSvc.GetPortalEffectiveCanonicalHost(ctx, compliancePage.ID)
if err != nil {
httpserver.RenderJSON(
w,
@@ -106,13 +106,13 @@ func NewSNIMiddleware(trustSvc *visitor.Service) func(next http.Handler) http.Ha
ctx = context.WithValue(
ctx,
compliancePageBaseURLKey,
compliancePortalBaseURLKey,
&baseURLString,
)
r = r.WithContext(ctx)
if compliancePage.Active {
ctx = context.WithValue(ctx, compliancePageKey, compliancePage)
ctx = context.WithValue(ctx, compliancePortalKey, compliancePage)
next.ServeHTTP(w, r.WithContext(ctx))
return

View File

@@ -26,7 +26,7 @@ func (r *mutationResolver) UpdateFullName(ctx context.Context, input types.Updat
return nil, gqlutils.Unauthenticatedf(ctx, "authentication is required to request access")
}
compliancePage := complianceportal.CompliancePageFromContext(ctx)
compliancePage := complianceportal.CompliancePortalFromContext(ctx)
profile, err := r.iam.OrganizationService.GetProfileForIdentityAndOrganization(ctx, identity.ID, compliancePage.OrganizationID)
if err != nil {

View File

@@ -43,13 +43,13 @@ func (r *queryResolver) Viewer(ctx context.Context) (*types.Identity, error) {
// Node is the resolver for the node field.
func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error) {
scope := coredata.NewScopeFromObjectID(id)
trustService := r.trust
visitorService := r.visitor
switch id.EntityType() {
case coredata.DocumentEntityType:
trustCenter := complianceportal.CompliancePageFromContext(ctx)
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
document, err := trustService.GetDocument(ctx, scope, trustCenter.OrganizationID, id)
document, err := visitorService.GetDocument(ctx, scope, compliancePortal.OrganizationID, id)
if err != nil {
if errors.Is(err, visitor.ErrDocumentNotFound) || errors.Is(err, visitor.ErrDocumentNotVisible) || errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFoundf(ctx, "node %q not found", id)
@@ -67,7 +67,7 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
return types.NewDocument(document), nil
case coredata.FrameworkEntityType:
framework, err := trustService.GetFramework(ctx, scope, id)
framework, err := visitorService.GetFramework(ctx, scope, id)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot get framework", log.Error(err))
return nil, gqlutils.Internal(ctx)
@@ -76,9 +76,9 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
return types.NewFramework(framework), nil
case coredata.FileEntityType:
trustCenter := complianceportal.CompliancePageFromContext(ctx)
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
file, err := trustService.GetReport(ctx, scope, trustCenter.OrganizationID, id)
file, err := visitorService.GetReport(ctx, scope, compliancePortal.OrganizationID, id)
if err != nil {
if errors.Is(err, visitor.ErrReportNotFound) || errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFoundf(ctx, "node %q not found", id)
@@ -92,7 +92,7 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
return types.NewAuditReport(file), nil
case coredata.AuditEntityType:
audit, err := trustService.GetAudit(ctx, scope, id)
audit, err := visitorService.GetAudit(ctx, scope, id)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot get audit", log.Error(err))
return nil, gqlutils.Internal(ctx)
@@ -101,7 +101,7 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
return types.NewAudit(audit), nil
case coredata.ThirdPartyEntityType:
thirdParty, err := trustService.GetThirdParty(ctx, scope, id)
thirdParty, err := visitorService.GetThirdParty(ctx, scope, id)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot get thirdParty", log.Error(err))
return nil, gqlutils.Internal(ctx)
@@ -109,39 +109,39 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
return types.NewSubprocessor(thirdParty), nil
case coredata.TrustCenterEntityType:
trustCenter, err := trustService.GetPortal(ctx, scope, id)
case coredata.CompliancePortalEntityType:
compliancePortal, err := visitorService.GetPortal(ctx, scope, id)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot get trust center", log.Error(err))
r.logger.ErrorCtx(ctx, "cannot get compliance portal", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewTrustCenter(trustCenter), nil
return types.NewCompliancePortal(compliancePortal), nil
case coredata.TrustCenterReferenceEntityType:
reference, err := trustService.GetPortalReference(ctx, scope, id)
case coredata.CompliancePortalReferenceEntityType:
reference, err := visitorService.GetPortalReference(ctx, scope, id)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot get trust center reference", log.Error(err))
r.logger.ErrorCtx(ctx, "cannot get compliance portal reference", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewTrustCenterReference(reference), nil
return types.NewCompliancePortalReference(reference), nil
case coredata.TrustCenterFileEntityType:
trustCenter := complianceportal.CompliancePageFromContext(ctx)
case coredata.CompliancePortalFileEntityType:
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
trustCenterFile, err := trustService.GetPortalFile(ctx, scope, trustCenter.OrganizationID, id)
portalFile, err := visitorService.GetPortalFile(ctx, scope, compliancePortal.OrganizationID, id)
if err != nil {
if errors.Is(err, visitor.ErrPortalFileNotFound) || errors.Is(err, visitor.ErrPortalFileNotVisible) {
return nil, gqlutils.NotFoundf(ctx, "node %q not found", id)
}
r.logger.ErrorCtx(ctx, "cannot get trust center file", log.Error(err))
r.logger.ErrorCtx(ctx, "cannot get compliance portal file", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewTrustCenterFile(trustCenterFile), nil
return types.NewCompliancePortalFile(portalFile), nil
default:
return nil, gqlutils.NotFoundf(ctx, "node %q not found", id)
@@ -152,8 +152,8 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
func (r *queryResolver) AliasedNode(ctx context.Context, alias string) (types.Node, error) {
resourceID, err := gid.ParseGID(alias)
if err != nil {
trustCenter := complianceportal.CompliancePageFromContext(ctx)
scope := coredata.NewScopeFromObjectID(trustCenter.ID)
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
scope := coredata.NewScopeFromObjectID(compliancePortal.ID)
resourceID, err = r.resourceAlias.ResolveAlias(
ctx,
@@ -174,22 +174,20 @@ func (r *queryResolver) AliasedNode(ctx context.Context, alias string) (types.No
return r.Node(ctx, resourceID)
}
// CurrentTrustCenter is the resolver for the currentTrustCenter field.
func (r *queryResolver) CurrentTrustCenter(ctx context.Context) (*types.TrustCenter, error) {
trustCenter := complianceportal.CompliancePageFromContext(ctx)
// CurrentCompliancePortal is the resolver for the currentCompliancePortal field.
func (r *queryResolver) CurrentCompliancePortal(ctx context.Context) (*types.CompliancePortal, error) {
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
scope := coredata.NewScopeFromObjectID(trustCenter.ID)
trustService := r.trust
scope := coredata.NewScopeFromObjectID(compliancePortal.ID)
visitorService := r.visitor
var err error
trustCenter, err = trustService.GetPortal(ctx, scope, trustCenter.ID)
compliancePortal, err := visitorService.GetPortal(ctx, scope, compliancePortal.ID)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot get trust center", log.Error(err))
r.logger.ErrorCtx(ctx, "cannot get compliance portal", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewTrustCenter(trustCenter), nil
return types.NewCompliancePortal(compliancePortal), nil
}
// OidcProviders is the resolver for the oidcProviders field.
@@ -225,10 +223,10 @@ func (r *queryResolver) MyRightsRequests(ctx context.Context, first *int, after
return types.NewRightsRequestConnection(emptyPage), nil
}
compliancePage := complianceportal.CompliancePageFromContext(ctx)
compliancePage := complianceportal.CompliancePortalFromContext(ctx)
scope := coredata.NewScopeFromObjectID(compliancePage.OrganizationID)
result, err := r.trust.ListRightsRequestsForOrganizationIDAndContact(
result, err := r.visitor.ListRightsRequestsForOrganizationIDAndContact(
ctx,
scope,
compliancePage.OrganizationID,

View File

@@ -56,7 +56,7 @@ func NewBrandDarkLogoHandler(logger *log.Logger, fileManager *filemanager.Servic
}
func (h *brandLogoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
compliancePage := complianceportal.CompliancePageFromContext(r.Context())
compliancePage := complianceportal.CompliancePortalFromContext(r.Context())
if compliancePage == nil {
httpserver.RenderError(w, http.StatusNotFound, errNotFound)
return

View File

@@ -26,12 +26,12 @@ type Query {
viewer: Identity
node(id: ID!): Node
aliasedNode(alias: String!): Node
currentTrustCenter: TrustCenter
currentCompliancePortal: CompliancePortal
oidcProviders: [OIDCProviderInfo!]!
@goField(forceResolver: true)
@authentication(required: OPTIONAL)
# The current viewer's own data subject requests for this trust center,
# The current viewer's own data subject requests for this compliance portal,
# scoped by their verified email. Returns an empty connection for guests so
# the portal can still render its empty state.
myRightsRequests(

View File

@@ -1,4 +1,4 @@
type TrustCenter implements Node {
type CompliancePortal implements Node {
id: ID!
active: Boolean!
slug: String!
@@ -20,7 +20,7 @@ type TrustCenter implements Node {
after: CursorKey
last: Int
before: CursorKey
filter: TrustCenterVisibilityFilter
filter: CompliancePortalVisibilityFilter
): DocumentConnection! @goField(forceResolver: true)
audits(
@@ -28,7 +28,7 @@ type TrustCenter implements Node {
after: CursorKey
last: Int
before: CursorKey
filter: TrustCenterVisibilityFilter
filter: CompliancePortalVisibilityFilter
): AuditConnection! @goField(forceResolver: true)
subprocessors(
@@ -49,7 +49,7 @@ type TrustCenter implements Node {
after: CursorKey
last: Int
before: CursorKey
): TrustCenterReferenceConnection! @goField(forceResolver: true)
): CompliancePortalReferenceConnection! @goField(forceResolver: true)
commitmentGroups(
first: Int
@@ -58,13 +58,13 @@ type TrustCenter implements Node {
before: CursorKey
): CompliancePortalCommitmentGroupConnection! @goField(forceResolver: true)
trustCenterFiles(
compliancePortalFiles(
first: Int
after: CursorKey
last: Int
before: CursorKey
filter: TrustCenterVisibilityFilter
): TrustCenterFileConnection! @goField(forceResolver: true)
filter: CompliancePortalVisibilityFilter
): CompliancePortalFileConnection! @goField(forceResolver: true)
complianceFrameworks(
first: Int
@@ -109,16 +109,16 @@ enum DocumentType
)
}
enum TrustCenterVisibility
@goModel(model: "go.probo.inc/probo/pkg/coredata.TrustCenterVisibility") {
enum CompliancePortalVisibility
@goModel(model: "go.probo.inc/probo/pkg/coredata.CompliancePortalVisibility") {
PRIVATE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.TrustCenterVisibilityPrivate")
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalVisibilityPrivate")
PUBLIC
@goEnum(value: "go.probo.inc/probo/pkg/coredata.TrustCenterVisibilityPublic")
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalVisibilityPublic")
}
input TrustCenterVisibilityFilter {
visibility: TrustCenterVisibility
input CompliancePortalVisibilityFilter {
visibility: CompliancePortalVisibility
}
type Document implements Node @nda {
@@ -291,7 +291,7 @@ type SubprocessorEdge @nda {
node: Subprocessor!
}
type TrustCenterReference implements Node @nda {
type CompliancePortalReference implements Node @nda {
id: ID!
name: String!
description: String
@@ -299,14 +299,14 @@ type TrustCenterReference implements Node @nda {
logo: File! @goField(forceResolver: true)
}
type TrustCenterReferenceConnection @nda {
edges: [TrustCenterReferenceEdge!]!
type CompliancePortalReferenceConnection @nda {
edges: [CompliancePortalReferenceEdge!]!
pageInfo: PageInfo!
}
type TrustCenterReferenceEdge @nda {
type CompliancePortalReferenceEdge @nda {
cursor: CursorKey!
node: TrustCenterReference!
node: CompliancePortalReference!
}
enum CompliancePortalCommitmentIcon
@@ -394,7 +394,7 @@ type CompliancePortalCommitmentEdge {
node: CompliancePortalCommitment!
}
type TrustCenterFile implements Node @nda {
type CompliancePortalFile implements Node @nda {
id: ID!
name: String!
category: String!
@@ -403,14 +403,14 @@ type TrustCenterFile implements Node @nda {
access: DocumentAccess @goField(forceResolver: true)
}
type TrustCenterFileConnection @nda {
edges: [TrustCenterFileEdge!]!
type CompliancePortalFileConnection @nda {
edges: [CompliancePortalFileEdge!]!
pageInfo: PageInfo!
}
type TrustCenterFileEdge @nda {
type CompliancePortalFileEdge @nda {
cursor: CursorKey!
node: TrustCenterFile!
node: CompliancePortalFile!
}
type ComplianceCustomLink implements Node {
@@ -430,7 +430,7 @@ type ComplianceCustomLinkEdge {
node: ComplianceCustomLink!
}
type TrustCenterAccess implements Node {
type CompliancePortalAccess implements Node {
id: ID!
email: EmailAddr!
name: String!
@@ -440,23 +440,23 @@ type TrustCenterAccess implements Node {
enum DocumentAccessStatus
@goModel(
model: "go.probo.inc/probo/pkg/coredata.TrustCenterDocumentAccessStatus"
model: "go.probo.inc/probo/pkg/coredata.CompliancePortalDocumentAccessStatus"
) {
REQUESTED
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.TrustCenterDocumentAccessStatusRequested"
value: "go.probo.inc/probo/pkg/coredata.CompliancePortalDocumentAccessStatusRequested"
)
GRANTED
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.TrustCenterDocumentAccessStatusGranted"
value: "go.probo.inc/probo/pkg/coredata.CompliancePortalDocumentAccessStatusGranted"
)
REJECTED
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.TrustCenterDocumentAccessStatusRejected"
value: "go.probo.inc/probo/pkg/coredata.CompliancePortalDocumentAccessStatusRejected"
)
REVOKED
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.TrustCenterDocumentAccessStatusRevoked"
value: "go.probo.inc/probo/pkg/coredata.CompliancePortalDocumentAccessStatusRevoked"
)
}
@@ -474,9 +474,9 @@ extend type Mutation {
exportReportPDF(input: ExportReportPDFInput!): ExportReportPDFPayload!
@authentication(required: OPTIONAL) @nda
exportTrustCenterFile(
input: ExportTrustCenterFileInput!
): ExportTrustCenterFilePayload! @authentication(required: OPTIONAL) @nda
exportCompliancePortalFile(
input: ExportCompliancePortalFileInput!
): ExportCompliancePortalFilePayload! @authentication(required: OPTIONAL) @nda
requestDocumentAccess(
input: RequestDocumentAccessInput!
@@ -486,8 +486,8 @@ extend type Mutation {
input: RequestReportAccessInput!
): RequestReportAccessPayload! @authentication(required: PRESENT) @nda
requestTrustCenterFileAccess(
input: RequestTrustCenterFileAccessInput!
requestCompliancePortalFileAccess(
input: RequestCompliancePortalFileAccessInput!
): RequestFileAccessPayload! @authentication(required: PRESENT) @nda
}
@@ -500,11 +500,11 @@ type RequestReportAccessPayload {
}
type RequestFileAccessPayload {
file: TrustCenterFile
file: CompliancePortalFile
}
type RequestAccessesPayload {
trustCenterAccess: TrustCenterAccess!
compliancePortalAccess: CompliancePortalAccess!
}
input ExportDocumentPDFInput {
@@ -523,12 +523,12 @@ input RequestReportAccessInput {
reportId: ID!
}
input RequestTrustCenterFileAccessInput {
trustCenterFileId: ID!
input RequestCompliancePortalFileAccessInput {
compliancePortalFileId: ID!
}
input ExportTrustCenterFileInput {
trustCenterFileId: ID!
input ExportCompliancePortalFileInput {
compliancePortalFileId: ID!
}
type ExportDocumentPDFPayload {
@@ -539,6 +539,6 @@ type ExportReportPDFPayload {
data: String!
}
type ExportTrustCenterFilePayload {
type ExportCompliancePortalFilePayload {
data: String!
}

View File

@@ -41,7 +41,7 @@ import (
func NewGraphQLHandler(
iamSvc *iam.Service,
trustSvc *visitor.Service,
visitorSvc *visitor.Service,
resourceAliasSvc *resourcealias.Service,
fileManagerSvc *filemanager.Service,
esignSvc *esign.Service,
@@ -55,7 +55,7 @@ func NewGraphQLHandler(
config := schema.Config{
Resolvers: &Resolver{
iam: iamSvc,
trust: trustSvc,
visitor: visitorSvc,
resourceAlias: resourceAliasSvc,
fileManager: fileManagerSvc,
esign: esignSvc,
@@ -65,7 +65,7 @@ func NewGraphQLHandler(
sessionCookie: authn.NewCookie(&cookieConfig),
},
Directives: schema.DirectiveRoot{
Nda: newNDADirective(logger, trustSvc, esignSvc),
Nda: newNDADirective(logger, visitorSvc, esignSvc),
Authentication: authentication.Directive,
SessionOnly: session.Directive,
},

View File

@@ -20,8 +20,8 @@ import (
// SubscribeToMailingList is the resolver for the subscribeToMailingList field.
func (r *mutationResolver) SubscribeToMailingList(ctx context.Context) (*types.SubscribeToMailingListPayload, error) {
trustCenter := complianceportal.CompliancePageFromContext(ctx)
if trustCenter.MailingListID == nil {
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
if compliancePortal.MailingListID == nil {
return nil, gqlutils.NotFoundf(ctx, "mailing list not found")
}
@@ -30,7 +30,7 @@ func (r *mutationResolver) SubscribeToMailingList(ctx context.Context) (*types.S
subscriber, err := r.mailman.CreateSubscriber(
ctx,
&mailman.CreateSubscriberRequest{
MailingListID: *trustCenter.MailingListID,
MailingListID: *compliancePortal.MailingListID,
Email: identity.EmailAddress,
FullName: identity.FullName,
},
@@ -56,14 +56,14 @@ func (r *mutationResolver) SubscribeToMailingList(ctx context.Context) (*types.S
// UnsubscribeFromMailingList is the resolver for the unsubscribeFromMailingList field.
func (r *mutationResolver) UnsubscribeFromMailingList(ctx context.Context) (*types.UnsubscribeFromMailingListPayload, error) {
trustCenter := complianceportal.CompliancePageFromContext(ctx)
if trustCenter.MailingListID == nil {
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
if compliancePortal.MailingListID == nil {
return nil, gqlutils.NotFoundf(ctx, "mailing list not found")
}
identity := authn.IdentityFromContext(ctx)
subscriber, err := r.mailman.GetSubscriber(ctx, *trustCenter.MailingListID, identity.EmailAddress)
subscriber, err := r.mailman.GetSubscriber(ctx, *compliancePortal.MailingListID, identity.EmailAddress)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot get mailing list subscription", log.Error(err))
return nil, gqlutils.Internal(ctx)

View File

@@ -102,7 +102,7 @@ func NewMux(cfg MuxConfig) (http.Handler, error) {
r.Group(
func(r chi.Router) {
r.Use(complianceportal.NewCompliancePagePresenceMiddleware())
r.Use(complianceportal.NewCompliancePortalPresenceMiddleware())
r.Method(http.MethodGet, complianceportal.CIMDMetadataPath, NewOAuthClientMetadataHandler(cfg.Visitor))
r.Method(http.MethodGet, complianceportal.BrandLogoPath, NewBrandLogoHandler(cfg.Logger, cfg.File))
@@ -128,12 +128,12 @@ func NewMux(cfg MuxConfig) (http.Handler, error) {
func compliancePageHeadData() HeadDataFunc {
return func(r *http.Request) HeadData {
tc := complianceportal.CompliancePageFromContext(r.Context())
tc := complianceportal.CompliancePortalFromContext(r.Context())
if tc == nil {
return HeadData{Title: "Compliance Page"}
}
compliancePageBaseURL := complianceportal.CompliancePageBaseURLFromContext(r.Context())
compliancePageBaseURL := complianceportal.CompliancePortalBaseURLFromContext(r.Context())
description := tc.Title + " Compliance Page"
if tc.Description != nil && *tc.Description != "" {

View File

@@ -35,7 +35,7 @@ import (
func newNDADirective(
logger *log.Logger,
trustSvc *visitor.Service,
visitorSvc *visitor.Service,
esignSvc *esign.Service,
) func(ctx context.Context, obj any, next graphql.Resolver) (any, error) {
return func(ctx context.Context, obj any, next graphql.Resolver) (any, error) {
@@ -44,13 +44,13 @@ func newNDADirective(
return next(ctx)
}
compliancePage := complianceportal.CompliancePageFromContext(ctx)
compliancePage := complianceportal.CompliancePortalFromContext(ctx)
if compliancePage == nil {
logger.ErrorCtx(ctx, "cannot get compliance page from context")
return nil, gqlutils.Internal(ctx)
}
membership, err := trustSvc.GetPortalMembership(ctx, compliancePage.ID, identity.ID)
membership, err := visitorSvc.GetPortalMembership(ctx, compliancePage.ID, identity.ID)
if err != nil {
logger.ErrorCtx(ctx, "cannot get compliance page membership", log.Error(err))
return nil, gqlutils.Internal(ctx)

View File

@@ -23,9 +23,9 @@ import (
// AcceptElectronicSignature is the resolver for the acceptElectronicSignature field.
func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input types.AcceptElectronicSignatureInput) (*types.AcceptElectronicSignaturePayload, error) {
var (
identity = authn.IdentityFromContext(ctx)
httpReq = gqlutils.HTTPRequestFromContext(ctx)
trustCenter = complianceportal.CompliancePageFromContext(ctx)
identity = authn.IdentityFromContext(ctx)
httpReq = gqlutils.HTTPRequestFromContext(ctx)
compliancePortal = complianceportal.CompliancePortalFromContext(ctx)
)
signerIP, _, _ := net.SplitHostPort(httpReq.RemoteAddr)
@@ -33,7 +33,7 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input
signerIP = httpReq.RemoteAddr
}
scope := coredata.NewScopeFromObjectID(trustCenter.ID)
scope := coredata.NewScopeFromObjectID(compliancePortal.ID)
signature, err := r.esign.AcceptSignature(
ctx,
@@ -59,9 +59,9 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input
// RecordSigningEvent is the resolver for the recordSigningEvent field.
func (r *mutationResolver) RecordSigningEvent(ctx context.Context, input types.RecordSigningEventInput) (*types.RecordSigningEventPayload, error) {
var (
identity = authn.IdentityFromContext(ctx)
httpReq = gqlutils.HTTPRequestFromContext(ctx)
trustCenter = complianceportal.CompliancePageFromContext(ctx)
identity = authn.IdentityFromContext(ctx)
httpReq = gqlutils.HTTPRequestFromContext(ctx)
compliancePortal = complianceportal.CompliancePortalFromContext(ctx)
)
actorIP, _, _ := net.SplitHostPort(httpReq.RemoteAddr)
@@ -69,7 +69,7 @@ func (r *mutationResolver) RecordSigningEvent(ctx context.Context, input types.R
actorIP = httpReq.RemoteAddr
}
scope := coredata.NewScopeFromObjectID(trustCenter.ID)
scope := coredata.NewScopeFromObjectID(compliancePortal.ID)
if err := r.esign.RecordEvent(
ctx,
@@ -92,13 +92,13 @@ func (r *mutationResolver) RecordSigningEvent(ctx context.Context, input types.R
// FileURL is the resolver for the fileUrl field.
func (r *nonDisclosureAgreementResolver) FileURL(ctx context.Context, obj *types.NonDisclosureAgreement) (string, error) {
trustCenter := complianceportal.CompliancePageFromContext(ctx)
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
if identity := authn.IdentityFromContext(ctx); identity != nil && r.esign != nil {
scope := coredata.NewScopeFromObjectID(trustCenter.ID)
trustService := r.trust
scope := coredata.NewScopeFromObjectID(compliancePortal.ID)
visitorService := r.visitor
access, err := trustService.GetPortalAccess(ctx, scope, trustCenter.ID, identity.ID)
access, err := visitorService.GetPortalAccess(ctx, scope, compliancePortal.ID, identity.ID)
if err == nil && access.ElectronicSignatureID != nil {
fileURL, err := r.esign.GenerateSignatureFileURL(ctx, *access.ElectronicSignatureID, 15*time.Minute)
if err == nil {
@@ -109,10 +109,10 @@ func (r *nonDisclosureAgreementResolver) FileURL(ctx context.Context, obj *types
}
}
scope := coredata.NewScopeFromObjectID(trustCenter.ID)
trustService := r.trust
scope := coredata.NewScopeFromObjectID(compliancePortal.ID)
visitorService := r.visitor
fileURL, err := trustService.GeneratePortalNDAFileURL(ctx, scope, trustCenter.ID, 15*time.Minute)
fileURL, err := visitorService.GeneratePortalNDAFileURL(ctx, scope, compliancePortal.ID, 15*time.Minute)
if err != nil {
return "", gqlutils.Internal(ctx)
}
@@ -127,11 +127,11 @@ func (r *nonDisclosureAgreementResolver) ViewerSignature(ctx context.Context, ob
return nil, nil
}
trustCenter := complianceportal.CompliancePageFromContext(ctx)
scope := coredata.NewScopeFromObjectID(trustCenter.ID)
trustService := r.trust
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
scope := coredata.NewScopeFromObjectID(compliancePortal.ID)
visitorService := r.visitor
access, err := trustService.GetPortalAccess(ctx, scope, trustCenter.ID, identity.ID)
access, err := visitorService.GetPortalAccess(ctx, scope, compliancePortal.ID, identity.ID)
if err != nil {
return nil, nil
}

View File

@@ -92,9 +92,9 @@ func (h *OAuthCallbackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
return
}
portal := complianceportal.CompliancePageFromContext(ctx)
portal := complianceportal.CompliancePortalFromContext(ctx)
portalBaseURL := complianceportal.CompliancePageBaseURLFromContext(ctx)
portalBaseURL := complianceportal.CompliancePortalBaseURLFromContext(ctx)
if portal == nil || portalBaseURL == nil {
httpserver.RenderError(w, http.StatusNotFound, errNotFound)
return

View File

@@ -34,8 +34,8 @@ func NewOAuthClientMetadataHandler(visitorSvc *visitor.Service) http.Handler {
func (h *oauthClientMetadataHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
compliancePage := complianceportal.CompliancePageFromContext(ctx)
baseURL := complianceportal.CompliancePageBaseURLFromContext(ctx)
compliancePage := complianceportal.CompliancePortalFromContext(ctx)
baseURL := complianceportal.CompliancePortalBaseURLFromContext(ctx)
if compliancePage == nil || baseURL == nil {
httpserver.RenderError(w, http.StatusNotFound, errNotFound)

View File

@@ -58,8 +58,8 @@ func NewOAuthInitiateHandler(
func (h *OAuthInitiateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
compliancePage := complianceportal.CompliancePageFromContext(ctx)
portalBaseURL := complianceportal.CompliancePageBaseURLFromContext(ctx)
compliancePage := complianceportal.CompliancePortalFromContext(ctx)
portalBaseURL := complianceportal.CompliancePortalBaseURLFromContext(ctx)
if compliancePage == nil || portalBaseURL == nil {
httpserver.RenderError(w, http.StatusNotFound, errNotFound)

View File

@@ -17,8 +17,6 @@
package complianceportal_v1
import (
"time"
"go.gearno.de/kit/log"
"go.probo.inc/probo/pkg/baseurl"
"go.probo.inc/probo/pkg/complianceportal/visitor"
@@ -31,19 +29,8 @@ import (
)
type (
TrustAuthConfig struct {
CookieName string
CookieDomain string
CookieDuration time.Duration
TokenDuration time.Duration
ReportURLDuration time.Duration
Scope string
TokenType string
CookieSecure bool
}
Resolver struct {
trust *visitor.Service
visitor *visitor.Service
resourceAlias *resourcealias.Service
fileManager *filemanager.Service
esign *esign.Service

View File

@@ -34,8 +34,8 @@ func (r *Resolver) ResourceAliasResolver(
ctx context.Context,
storageResourceID gid.GID,
) (*string, error) {
trustCenter := complianceportal.CompliancePageFromContext(ctx)
scope := coredata.NewScopeFromObjectID(trustCenter.ID)
compliancePortal := complianceportal.CompliancePortalFromContext(ctx)
scope := coredata.NewScopeFromObjectID(compliancePortal.ID)
alias, err := r.resourceAlias.GetByResourceID(ctx, scope, storageResourceID)
if err != nil {

View File

@@ -9,7 +9,7 @@ import (
"context"
"go.gearno.de/kit/log"
trust "go.probo.inc/probo/pkg/complianceportal/visitor"
"go.probo.inc/probo/pkg/complianceportal/visitor"
"go.probo.inc/probo/pkg/coredata"
"go.probo.inc/probo/pkg/server/api/authn"
"go.probo.inc/probo/pkg/server/api/complianceportal"
@@ -26,13 +26,13 @@ func (r *mutationResolver) CreateRightsRequest(ctx context.Context, input types.
return nil, gqlutils.Unauthenticatedf(ctx, "a verified email is required to submit a request")
}
compliancePage := complianceportal.CompliancePageFromContext(ctx)
compliancePage := complianceportal.CompliancePortalFromContext(ctx)
scope := coredata.NewScopeFromObjectID(compliancePage.OrganizationID)
rightsRequest, err := r.trust.CreateRightsRequest(
rightsRequest, err := r.visitor.CreateRightsRequest(
ctx,
scope,
&trust.CreateRightsRequest{
&visitor.CreateRightsRequest{
OrganizationID: compliancePage.OrganizationID,
RequestType: input.RequestType,
DataSubject: input.DataSubject,

View File

@@ -24,16 +24,16 @@ import (
"go.probo.inc/probo/pkg/coredata"
)
func NewTrustCenter(tc *coredata.TrustCenter) *TrustCenter {
return &TrustCenter{
ID: tc.ID,
Active: tc.Active,
Slug: tc.Slug,
Title: tc.Title,
Description: tc.Description,
WebsiteURL: tc.WebsiteURL,
Email: tc.Email,
HeadquarterAddress: tc.HeadquarterAddress,
func NewCompliancePortal(cp *coredata.CompliancePortal) *CompliancePortal {
return &CompliancePortal{
ID: cp.ID,
Active: cp.Active,
Slug: cp.Slug,
Title: cp.Title,
Description: cp.Description,
WebsiteURL: cp.WebsiteURL,
Email: cp.Email,
HeadquarterAddress: cp.HeadquarterAddress,
}
}

View File

@@ -25,31 +25,34 @@ import (
"go.probo.inc/probo/pkg/page"
)
func NewTrustCenterFileConnection(
p *page.Page[*coredata.TrustCenterFile, coredata.TrustCenterFileOrderField],
) *TrustCenterFileConnection {
edges := make([]*TrustCenterFileEdge, len(p.Data))
for i, trustCenterFile := range p.Data {
edges[i] = NewTrustCenterFileEdge(trustCenterFile, p.Cursor.OrderBy.Field)
func NewCompliancePortalFileConnection(
p *page.Page[*coredata.CompliancePortalFile, coredata.CompliancePortalFileOrderField],
) *CompliancePortalFileConnection {
edges := make([]*CompliancePortalFileEdge, len(p.Data))
for i, portalFile := range p.Data {
edges[i] = NewCompliancePortalFileEdge(portalFile, p.Cursor.OrderBy.Field)
}
return &TrustCenterFileConnection{
return &CompliancePortalFileConnection{
Edges: edges,
PageInfo: NewPageInfo(p),
}
}
func NewTrustCenterFile(f *coredata.TrustCenterFile) *TrustCenterFile {
return &TrustCenterFile{
func NewCompliancePortalFile(f *coredata.CompliancePortalFile) *CompliancePortalFile {
return &CompliancePortalFile{
ID: f.ID,
Name: f.Name,
Category: f.Category,
}
}
func NewTrustCenterFileEdge(f *coredata.TrustCenterFile, orderField coredata.TrustCenterFileOrderField) *TrustCenterFileEdge {
return &TrustCenterFileEdge{
Node: NewTrustCenterFile(f),
func NewCompliancePortalFileEdge(
f *coredata.CompliancePortalFile,
orderField coredata.CompliancePortalFileOrderField,
) *CompliancePortalFileEdge {
return &CompliancePortalFileEdge{
Node: NewCompliancePortalFile(f),
Cursor: f.CursorKey(orderField),
}
}

View File

@@ -25,31 +25,36 @@ import (
"go.probo.inc/probo/pkg/page"
)
func NewTrustCenterReference(tcc *coredata.TrustCenterReference) *TrustCenterReference {
return &TrustCenterReference{
ID: tcc.ID,
Name: tcc.Name,
Description: tcc.Description,
WebsiteURL: tcc.WebsiteURL,
func NewCompliancePortalReference(ref *coredata.CompliancePortalReference) *CompliancePortalReference {
return &CompliancePortalReference{
ID: ref.ID,
Name: ref.Name,
Description: ref.Description,
WebsiteURL: ref.WebsiteURL,
}
}
func NewTrustCenterReferenceConnection(p *page.Page[*coredata.TrustCenterReference, coredata.TrustCenterReferenceOrderField]) *TrustCenterReferenceConnection {
edges := make([]*TrustCenterReferenceEdge, len(p.Data))
func NewCompliancePortalReferenceConnection(
p *page.Page[*coredata.CompliancePortalReference, coredata.CompliancePortalReferenceOrderField],
) *CompliancePortalReferenceConnection {
edges := make([]*CompliancePortalReferenceEdge, len(p.Data))
for i, item := range p.Data {
edges[i] = NewTrustCenterReferenceEdge(item, p.Cursor.OrderBy.Field)
edges[i] = NewCompliancePortalReferenceEdge(item, p.Cursor.OrderBy.Field)
}
return &TrustCenterReferenceConnection{
return &CompliancePortalReferenceConnection{
Edges: edges,
PageInfo: NewPageInfo(p),
}
}
func NewTrustCenterReferenceEdge(tcc *coredata.TrustCenterReference, orderBy coredata.TrustCenterReferenceOrderField) *TrustCenterReferenceEdge {
return &TrustCenterReferenceEdge{
Cursor: tcc.CursorKey(orderBy),
Node: NewTrustCenterReference(tcc),
func NewCompliancePortalReferenceEdge(
ref *coredata.CompliancePortalReference,
orderBy coredata.CompliancePortalReferenceOrderField,
) *CompliancePortalReferenceEdge {
return &CompliancePortalReferenceEdge{
Cursor: ref.CursorKey(orderBy),
Node: NewCompliancePortalReference(ref),
}
}