Add trust center access requests

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-08-20 11:29:18 +02:00
parent ccbd9e250c
commit 5db9b9f787
31 changed files with 1977 additions and 330 deletions

View File

@@ -1521,6 +1521,7 @@ type TrustCenterAccess implements Node {
id: ID!
email: String!
name: String!
active: Boolean!
createdAt: Datetime!
updatedAt: Datetime!
}
@@ -1821,6 +1822,10 @@ type Mutation {
input: CreateTrustCenterAccessInput!
): CreateTrustCenterAccessPayload!
updateTrustCenterAccess(
input: UpdateTrustCenterAccessInput!
): UpdateTrustCenterAccessPayload!
deleteTrustCenterAccess(
input: DeleteTrustCenterAccessInput!
): DeleteTrustCenterAccessPayload!
@@ -2068,10 +2073,17 @@ input CreateTrustCenterAccessInput {
trustCenterId: ID!
email: String!
name: String!
active: Boolean!
}
input UpdateTrustCenterAccessInput {
id: ID!
name: String
active: Boolean
}
input DeleteTrustCenterAccessInput {
accessId: ID!
id: ID!
}
input CreateVendorInput {
@@ -2604,6 +2616,10 @@ type CreateTrustCenterAccessPayload {
trustCenterAccessEdge: TrustCenterAccessEdge!
}
type UpdateTrustCenterAccessPayload {
trustCenterAccess: TrustCenterAccess!
}
type DeleteTrustCenterAccessPayload {
deletedTrustCenterAccessId: ID!
}

View File

@@ -749,6 +749,7 @@ type ComplexityRoot struct {
UpdateRisk func(childComplexity int, input types.UpdateRiskInput) int
UpdateTask func(childComplexity int, input types.UpdateTaskInput) int
UpdateTrustCenter func(childComplexity int, input types.UpdateTrustCenterInput) int
UpdateTrustCenterAccess func(childComplexity int, input types.UpdateTrustCenterAccessInput) int
UpdateVendor func(childComplexity int, input types.UpdateVendorInput) int
UpdateVendorBusinessAssociateAgreement func(childComplexity int, input types.UpdateVendorBusinessAssociateAgreementInput) int
UpdateVendorContact func(childComplexity int, input types.UpdateVendorContactInput) int
@@ -968,6 +969,7 @@ type ComplexityRoot struct {
}
TrustCenterAccess struct {
Active func(childComplexity int) int
CreatedAt func(childComplexity int) int
Email func(childComplexity int) int
ID func(childComplexity int) int
@@ -1055,6 +1057,10 @@ type ComplexityRoot struct {
Task func(childComplexity int) int
}
UpdateTrustCenterAccessPayload struct {
TrustCenterAccess func(childComplexity int) int
}
UpdateTrustCenterPayload struct {
TrustCenter func(childComplexity int) int
}
@@ -1385,6 +1391,7 @@ type MutationResolver interface {
DeleteOrganization(ctx context.Context, input types.DeleteOrganizationInput) (*types.DeleteOrganizationPayload, error)
UpdateTrustCenter(ctx context.Context, input types.UpdateTrustCenterInput) (*types.UpdateTrustCenterPayload, error)
CreateTrustCenterAccess(ctx context.Context, input types.CreateTrustCenterAccessInput) (*types.CreateTrustCenterAccessPayload, error)
UpdateTrustCenterAccess(ctx context.Context, input types.UpdateTrustCenterAccessInput) (*types.UpdateTrustCenterAccessPayload, error)
DeleteTrustCenterAccess(ctx context.Context, input types.DeleteTrustCenterAccessInput) (*types.DeleteTrustCenterAccessPayload, error)
ConfirmEmail(ctx context.Context, input types.ConfirmEmailInput) (*types.ConfirmEmailPayload, error)
InviteUser(ctx context.Context, input types.InviteUserInput) (*types.InviteUserPayload, error)
@@ -4557,6 +4564,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.Mutation.UpdateTrustCenter(childComplexity, args["input"].(types.UpdateTrustCenterInput)), true
case "Mutation.updateTrustCenterAccess":
if e.complexity.Mutation.UpdateTrustCenterAccess == nil {
break
}
args, err := ec.field_Mutation_updateTrustCenterAccess_args(ctx, rawArgs)
if err != nil {
return 0, false
}
return e.complexity.Mutation.UpdateTrustCenterAccess(childComplexity, args["input"].(types.UpdateTrustCenterAccessInput)), true
case "Mutation.updateVendor":
if e.complexity.Mutation.UpdateVendor == nil {
break
@@ -5709,6 +5728,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.TrustCenter.UpdatedAt(childComplexity), true
case "TrustCenterAccess.active":
if e.complexity.TrustCenterAccess.Active == nil {
break
}
return e.complexity.TrustCenterAccess.Active(childComplexity), true
case "TrustCenterAccess.createdAt":
if e.complexity.TrustCenterAccess.CreatedAt == nil {
break
@@ -5905,6 +5931,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.UpdateTaskPayload.Task(childComplexity), true
case "UpdateTrustCenterAccessPayload.trustCenterAccess":
if e.complexity.UpdateTrustCenterAccessPayload.TrustCenterAccess == nil {
break
}
return e.complexity.UpdateTrustCenterAccessPayload.TrustCenterAccess(childComplexity), true
case "UpdateTrustCenterPayload.trustCenter":
if e.complexity.UpdateTrustCenterPayload.TrustCenter == nil {
break
@@ -6937,6 +6970,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
ec.unmarshalInputUpdatePeopleInput,
ec.unmarshalInputUpdateRiskInput,
ec.unmarshalInputUpdateTaskInput,
ec.unmarshalInputUpdateTrustCenterAccessInput,
ec.unmarshalInputUpdateTrustCenterInput,
ec.unmarshalInputUpdateVendorBusinessAssociateAgreementInput,
ec.unmarshalInputUpdateVendorContactInput,
@@ -8575,6 +8609,7 @@ type TrustCenterAccess implements Node {
id: ID!
email: String!
name: String!
active: Boolean!
createdAt: Datetime!
updatedAt: Datetime!
}
@@ -8875,6 +8910,10 @@ type Mutation {
input: CreateTrustCenterAccessInput!
): CreateTrustCenterAccessPayload!
updateTrustCenterAccess(
input: UpdateTrustCenterAccessInput!
): UpdateTrustCenterAccessPayload!
deleteTrustCenterAccess(
input: DeleteTrustCenterAccessInput!
): DeleteTrustCenterAccessPayload!
@@ -9122,10 +9161,17 @@ input CreateTrustCenterAccessInput {
trustCenterId: ID!
email: String!
name: String!
active: Boolean!
}
input UpdateTrustCenterAccessInput {
id: ID!
name: String
active: Boolean
}
input DeleteTrustCenterAccessInput {
accessId: ID!
id: ID!
}
input CreateVendorInput {
@@ -9658,6 +9704,10 @@ type CreateTrustCenterAccessPayload {
trustCenterAccessEdge: TrustCenterAccessEdge!
}
type UpdateTrustCenterAccessPayload {
trustCenterAccess: TrustCenterAccess!
}
type DeleteTrustCenterAccessPayload {
deletedTrustCenterAccessId: ID!
}
@@ -13777,6 +13827,29 @@ func (ec *executionContext) field_Mutation_updateTask_argsInput(
return zeroVal, nil
}
func (ec *executionContext) field_Mutation_updateTrustCenterAccess_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
arg0, err := ec.field_Mutation_updateTrustCenterAccess_argsInput(ctx, rawArgs)
if err != nil {
return nil, err
}
args["input"] = arg0
return args, nil
}
func (ec *executionContext) field_Mutation_updateTrustCenterAccess_argsInput(
ctx context.Context,
rawArgs map[string]any,
) (types.UpdateTrustCenterAccessInput, error) {
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
if tmp, ok := rawArgs["input"]; ok {
return ec.unmarshalNUpdateTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessInput(ctx, tmp)
}
var zeroVal types.UpdateTrustCenterAccessInput
return zeroVal, nil
}
func (ec *executionContext) field_Mutation_updateTrustCenter_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
@@ -30399,6 +30472,65 @@ func (ec *executionContext) fieldContext_Mutation_createTrustCenterAccess(ctx co
return fc, nil
}
func (ec *executionContext) _Mutation_updateTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_updateTrustCenterAccess(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().UpdateTrustCenterAccess(rctx, fc.Args["input"].(types.UpdateTrustCenterAccessInput))
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*types.UpdateTrustCenterAccessPayload)
fc.Result = res
return ec.marshalNUpdateTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessPayload(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Mutation_updateTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Mutation",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "trustCenterAccess":
return ec.fieldContext_UpdateTrustCenterAccessPayload_trustCenterAccess(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type UpdateTrustCenterAccessPayload", field.Name)
},
}
defer func() {
if r := recover(); r != nil {
err = ec.Recover(ctx, r)
ec.Error(ctx, err)
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
if fc.Args, err = ec.field_Mutation_updateTrustCenterAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
ec.Error(ctx, err)
return fc, err
}
return fc, nil
}
func (ec *executionContext) _Mutation_deleteTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_deleteTrustCenterAccess(ctx, field)
if err != nil {
@@ -42810,6 +42942,50 @@ func (ec *executionContext) fieldContext_TrustCenterAccess_name(_ context.Contex
return fc, nil
}
func (ec *executionContext) _TrustCenterAccess_active(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TrustCenterAccess_active(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Active, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TrustCenterAccess_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TrustCenterAccess",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type Boolean does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TrustCenterAccess_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TrustCenterAccess_createdAt(ctx, field)
if err != nil {
@@ -43091,6 +43267,8 @@ func (ec *executionContext) fieldContext_TrustCenterAccessEdge_node(_ context.Co
return ec.fieldContext_TrustCenterAccess_email(ctx, field)
case "name":
return ec.fieldContext_TrustCenterAccess_name(ctx, field)
case "active":
return ec.fieldContext_TrustCenterAccess_active(ctx, field)
case "createdAt":
return ec.fieldContext_TrustCenterAccess_createdAt(ctx, field)
case "updatedAt":
@@ -44380,6 +44558,64 @@ func (ec *executionContext) fieldContext_UpdateTaskPayload_task(_ context.Contex
return fc, nil
}
func (ec *executionContext) _UpdateTrustCenterAccessPayload_trustCenterAccess(ctx context.Context, field graphql.CollectedField, obj *types.UpdateTrustCenterAccessPayload) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_UpdateTrustCenterAccessPayload_trustCenterAccess(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.TrustCenterAccess, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*types.TrustCenterAccess)
fc.Result = res
return ec.marshalNTrustCenterAccess2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐTrustCenterAccess(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_UpdateTrustCenterAccessPayload_trustCenterAccess(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "UpdateTrustCenterAccessPayload",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "id":
return ec.fieldContext_TrustCenterAccess_id(ctx, field)
case "email":
return ec.fieldContext_TrustCenterAccess_email(ctx, field)
case "name":
return ec.fieldContext_TrustCenterAccess_name(ctx, field)
case "active":
return ec.fieldContext_TrustCenterAccess_active(ctx, field)
case "createdAt":
return ec.fieldContext_TrustCenterAccess_createdAt(ctx, field)
case "updatedAt":
return ec.fieldContext_TrustCenterAccess_updatedAt(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type TrustCenterAccess", field.Name)
},
}
return fc, nil
}
func (ec *executionContext) _UpdateTrustCenterPayload_trustCenter(ctx context.Context, field graphql.CollectedField, obj *types.UpdateTrustCenterPayload) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_UpdateTrustCenterPayload_trustCenter(ctx, field)
if err != nil {
@@ -54434,7 +54670,7 @@ func (ec *executionContext) unmarshalInputCreateTrustCenterAccessInput(ctx conte
asMap[k] = v
}
fieldsInOrder := [...]string{"trustCenterId", "email", "name"}
fieldsInOrder := [...]string{"trustCenterId", "email", "name", "active"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
@@ -54462,6 +54698,13 @@ func (ec *executionContext) unmarshalInputCreateTrustCenterAccessInput(ctx conte
return it, err
}
it.Name = data
case "active":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active"))
data, err := ec.unmarshalNBoolean2bool(ctx, v)
if err != nil {
return it, err
}
it.Active = data
}
}
@@ -55436,20 +55679,20 @@ func (ec *executionContext) unmarshalInputDeleteTrustCenterAccessInput(ctx conte
asMap[k] = v
}
fieldsInOrder := [...]string{"accessId"}
fieldsInOrder := [...]string{"id"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
continue
}
switch k {
case "accessId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("accessId"))
case "id":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
if err != nil {
return it, err
}
it.AccessID = data
it.ID = data
}
}
@@ -57588,6 +57831,47 @@ func (ec *executionContext) unmarshalInputUpdateTaskInput(ctx context.Context, o
return it, nil
}
func (ec *executionContext) unmarshalInputUpdateTrustCenterAccessInput(ctx context.Context, obj any) (types.UpdateTrustCenterAccessInput, error) {
var it types.UpdateTrustCenterAccessInput
asMap := map[string]any{}
for k, v := range obj.(map[string]any) {
asMap[k] = v
}
fieldsInOrder := [...]string{"id", "name", "active"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
continue
}
switch k {
case "id":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
if err != nil {
return it, err
}
it.ID = data
case "name":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
if err != nil {
return it, err
}
it.Name = data
case "active":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("active"))
data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v)
if err != nil {
return it, err
}
it.Active = data
}
}
return it, nil
}
func (ec *executionContext) unmarshalInputUpdateTrustCenterInput(ctx context.Context, obj any) (types.UpdateTrustCenterInput, error) {
var it types.UpdateTrustCenterInput
asMap := map[string]any{}
@@ -64935,6 +65219,13 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "updateTrustCenterAccess":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_updateTrustCenterAccess(ctx, field)
})
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "deleteTrustCenterAccess":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_deleteTrustCenterAccess(ctx, field)
@@ -68257,6 +68548,11 @@ func (ec *executionContext) _TrustCenterAccess(ctx context.Context, sel ast.Sele
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "active":
out.Values[i] = ec._TrustCenterAccess_active(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "createdAt":
out.Values[i] = ec._TrustCenterAccess_createdAt(ctx, field, obj)
if out.Values[i] == graphql.Null {
@@ -69051,6 +69347,45 @@ func (ec *executionContext) _UpdateTaskPayload(ctx context.Context, sel ast.Sele
return out
}
var updateTrustCenterAccessPayloadImplementors = []string{"UpdateTrustCenterAccessPayload"}
func (ec *executionContext) _UpdateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateTrustCenterAccessPayload) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, updateTrustCenterAccessPayloadImplementors)
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
for i, field := range fields {
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("UpdateTrustCenterAccessPayload")
case "trustCenterAccess":
out.Values[i] = ec._UpdateTrustCenterAccessPayload_trustCenterAccess(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
default:
panic("unknown field " + strconv.Quote(field.Name))
}
}
out.Dispatch(ctx)
if out.Invalids > 0 {
return graphql.Null
}
atomic.AddInt32(&ec.deferred, int32(len(deferred)))
for label, dfs := range deferred {
ec.processDeferredGroup(graphql.DeferredGroup{
Label: label,
Path: graphql.GetPath(ctx),
FieldSet: dfs,
Context: ctx,
})
}
return out
}
var updateTrustCenterPayloadImplementors = []string{"UpdateTrustCenterPayload"}
func (ec *executionContext) _UpdateTrustCenterPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateTrustCenterPayload) graphql.Marshaler {
@@ -76120,6 +76455,25 @@ func (ec *executionContext) marshalNUpdateTaskPayload2ᚖgithubᚗcomᚋgetprobo
return ec._UpdateTaskPayload(ctx, sel, v)
}
func (ec *executionContext) unmarshalNUpdateTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessInput(ctx context.Context, v any) (types.UpdateTrustCenterAccessInput, error) {
res, err := ec.unmarshalInputUpdateTrustCenterAccessInput(ctx, v)
return res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalNUpdateTrustCenterAccessPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v types.UpdateTrustCenterAccessPayload) graphql.Marshaler {
return ec._UpdateTrustCenterAccessPayload(ctx, sel, &v)
}
func (ec *executionContext) marshalNUpdateTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v *types.UpdateTrustCenterAccessPayload) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._UpdateTrustCenterAccessPayload(ctx, sel, v)
}
func (ec *executionContext) unmarshalNUpdateTrustCenterInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTrustCenterInput(ctx context.Context, v any) (types.UpdateTrustCenterInput, error) {
res, err := ec.unmarshalInputUpdateTrustCenterInput(ctx, v)
return res, graphql.ErrorOnPath(ctx, err)

View File

@@ -26,6 +26,7 @@ func NewTrustCenterAccess(tca *coredata.TrustCenterAccess) *TrustCenterAccess {
ID: tca.ID,
Email: tca.Email,
Name: tca.Name,
Active: tca.Active,
CreatedAt: tca.CreatedAt,
UpdatedAt: tca.UpdatedAt,
}

View File

@@ -448,6 +448,7 @@ type CreateTrustCenterAccessInput struct {
TrustCenterID gid.GID `json:"trustCenterId"`
Email string `json:"email"`
Name string `json:"name"`
Active bool `json:"active"`
}
type CreateTrustCenterAccessPayload struct {
@@ -715,7 +716,7 @@ type DeleteTaskPayload struct {
}
type DeleteTrustCenterAccessInput struct {
AccessID gid.GID `json:"accessId"`
ID gid.GID `json:"id"`
}
type DeleteTrustCenterAccessPayload struct {
@@ -1240,6 +1241,7 @@ type TrustCenterAccess struct {
ID gid.GID `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
Active bool `json:"active"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
@@ -1470,6 +1472,16 @@ type UpdateTaskPayload struct {
Task *Task `json:"task"`
}
type UpdateTrustCenterAccessInput struct {
ID gid.GID `json:"id"`
Name *string `json:"name,omitempty"`
Active *bool `json:"active,omitempty"`
}
type UpdateTrustCenterAccessPayload struct {
TrustCenterAccess *TrustCenterAccess `json:"trustCenterAccess"`
}
type UpdateTrustCenterInput struct {
TrustCenterID gid.GID `json:"trustCenterId"`
Active *bool `json:"active,omitempty"`

View File

@@ -1143,6 +1143,7 @@ func (r *mutationResolver) CreateTrustCenterAccess(ctx context.Context, input ty
TrustCenterID: input.TrustCenterID,
Email: input.Email,
Name: input.Name,
Active: input.Active,
})
if err != nil {
return nil, fmt.Errorf("cannot create trust center access: %w", err)
@@ -1153,19 +1154,37 @@ func (r *mutationResolver) CreateTrustCenterAccess(ctx context.Context, input ty
}, nil
}
// UpdateTrustCenterAccess is the resolver for the updateTrustCenterAccess field.
func (r *mutationResolver) UpdateTrustCenterAccess(ctx context.Context, input types.UpdateTrustCenterAccessInput) (*types.UpdateTrustCenterAccessPayload, error) {
prb := r.ProboService(ctx, input.ID.TenantID())
access, err := prb.TrustCenterAccesses.Update(ctx, &probo.UpdateTrustCenterAccessRequest{
ID: input.ID,
Name: input.Name,
Active: input.Active,
})
if err != nil {
panic(fmt.Errorf("cannot update trust center access: %w", err))
}
return &types.UpdateTrustCenterAccessPayload{
TrustCenterAccess: types.NewTrustCenterAccess(access),
}, nil
}
// DeleteTrustCenterAccess is the resolver for the deleteTrustCenterAccess field.
func (r *mutationResolver) DeleteTrustCenterAccess(ctx context.Context, input types.DeleteTrustCenterAccessInput) (*types.DeleteTrustCenterAccessPayload, error) {
prb := r.ProboService(ctx, input.AccessID.TenantID())
prb := r.ProboService(ctx, input.ID.TenantID())
err := prb.TrustCenterAccesses.Delete(ctx, &probo.DeleteTrustCenterAccessRequest{
AccessID: input.AccessID,
ID: input.ID,
})
if err != nil {
return nil, fmt.Errorf("cannot delete trust center access: %w", err)
}
return &types.DeleteTrustCenterAccessPayload{
DeletedTrustCenterAccessID: input.AccessID,
DeletedTrustCenterAccessID: input.ID,
}, nil
}

View File

@@ -105,7 +105,7 @@ func NewMux(
r.Handle("/graphql", graphqlHandler(logger, usrmgrSvc, trustSvc, authCfg, trustAuthCfg))
r.Post("/auth/authenticate", authTokenHandler(trustSvc, trustAuthCfg))
r.Delete("/auth/logout", trustCenterLogoutHandler(trustAuthCfg))
r.Delete("/auth/logout", trustCenterLogoutHandler(authCfg, trustAuthCfg))
return r
}

View File

@@ -80,7 +80,6 @@ type Audit implements Node {
id: ID!
framework: Framework! @goField(forceResolver: true)
report: Report @goField(forceResolver: true)
reportUrl: String @goField(forceResolver: true) @mustBeAuthenticated(role: USER)
}
type AuditConnection {
@@ -224,6 +223,24 @@ type TrustCenter implements Node {
): VendorConnection! @goField(forceResolver: true)
}
type TrustCenterAccess implements Node {
id: ID!
email: String!
name: String!
createdAt: Datetime!
updatedAt: Datetime!
}
input CreateTrustCenterAccessInput {
trustCenterId: ID!
email: String!
name: String!
}
type CreateTrustCenterAccessPayload {
trustCenterAccess: TrustCenterAccess!
}
input ExportDocumentPDFInput {
documentId: ID!
}
@@ -237,6 +254,10 @@ type Query {
}
type Mutation {
createTrustCenterAccess(
input: CreateTrustCenterAccessInput!
): CreateTrustCenterAccessPayload! @mustBeAuthenticated(role: NONE)
exportDocumentPDF(
input: ExportDocumentPDFInput!
): ExportDocumentPDFPayload! @mustBeAuthenticated(role: USER)

View File

@@ -10,6 +10,7 @@ import (
"strconv"
"sync"
"sync/atomic"
"time"
"github.com/99designs/gqlgen/graphql"
"github.com/99designs/gqlgen/graphql/introspection"
@@ -60,7 +61,6 @@ type ComplexityRoot struct {
Framework func(childComplexity int) int
ID func(childComplexity int) int
Report func(childComplexity int) int
ReportURL func(childComplexity int) int
}
AuditConnection struct {
@@ -73,6 +73,10 @@ type ComplexityRoot struct {
Node func(childComplexity int) int
}
CreateTrustCenterAccessPayload struct {
TrustCenterAccess func(childComplexity int) int
}
Document struct {
DocumentType func(childComplexity int) int
ID func(childComplexity int) int
@@ -99,7 +103,8 @@ type ComplexityRoot struct {
}
Mutation struct {
ExportDocumentPDF func(childComplexity int, input types.ExportDocumentPDFInput) int
CreateTrustCenterAccess func(childComplexity int, input types.CreateTrustCenterAccessInput) int
ExportDocumentPDF func(childComplexity int, input types.ExportDocumentPDFInput) int
}
Organization struct {
@@ -135,6 +140,14 @@ type ComplexityRoot struct {
Vendors func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int
}
TrustCenterAccess struct {
CreatedAt func(childComplexity int) int
Email func(childComplexity int) int
ID func(childComplexity int) int
Name func(childComplexity int) int
UpdatedAt func(childComplexity int) int
}
Vendor struct {
Category func(childComplexity int) int
ID func(childComplexity int) int
@@ -157,9 +170,9 @@ type ComplexityRoot struct {
type AuditResolver interface {
Framework(ctx context.Context, obj *types.Audit) (*types.Framework, error)
Report(ctx context.Context, obj *types.Audit) (*types.Report, error)
ReportURL(ctx context.Context, obj *types.Audit) (*string, error)
}
type MutationResolver interface {
CreateTrustCenterAccess(ctx context.Context, input types.CreateTrustCenterAccessInput) (*types.CreateTrustCenterAccessPayload, error)
ExportDocumentPDF(ctx context.Context, input types.ExportDocumentPDFInput) (*types.ExportDocumentPDFPayload, error)
}
type OrganizationResolver interface {
@@ -218,13 +231,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.Audit.Report(childComplexity), true
case "Audit.reportUrl":
if e.complexity.Audit.ReportURL == nil {
break
}
return e.complexity.Audit.ReportURL(childComplexity), true
case "AuditConnection.edges":
if e.complexity.AuditConnection.Edges == nil {
break
@@ -253,6 +259,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.AuditEdge.Node(childComplexity), true
case "CreateTrustCenterAccessPayload.trustCenterAccess":
if e.complexity.CreateTrustCenterAccessPayload.TrustCenterAccess == nil {
break
}
return e.complexity.CreateTrustCenterAccessPayload.TrustCenterAccess(childComplexity), true
case "Document.documentType":
if e.complexity.Document.DocumentType == nil {
break
@@ -323,6 +336,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.Framework.Name(childComplexity), true
case "Mutation.createTrustCenterAccess":
if e.complexity.Mutation.CreateTrustCenterAccess == nil {
break
}
args, err := ec.field_Mutation_createTrustCenterAccess_args(ctx, rawArgs)
if err != nil {
return 0, false
}
return e.complexity.Mutation.CreateTrustCenterAccess(childComplexity, args["input"].(types.CreateTrustCenterAccessInput)), true
case "Mutation.exportDocumentPDF":
if e.complexity.Mutation.ExportDocumentPDF == nil {
break
@@ -481,6 +506,41 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.TrustCenter.Vendors(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey)), true
case "TrustCenterAccess.createdAt":
if e.complexity.TrustCenterAccess.CreatedAt == nil {
break
}
return e.complexity.TrustCenterAccess.CreatedAt(childComplexity), true
case "TrustCenterAccess.email":
if e.complexity.TrustCenterAccess.Email == nil {
break
}
return e.complexity.TrustCenterAccess.Email(childComplexity), true
case "TrustCenterAccess.id":
if e.complexity.TrustCenterAccess.ID == nil {
break
}
return e.complexity.TrustCenterAccess.ID(childComplexity), true
case "TrustCenterAccess.name":
if e.complexity.TrustCenterAccess.Name == nil {
break
}
return e.complexity.TrustCenterAccess.Name(childComplexity), true
case "TrustCenterAccess.updatedAt":
if e.complexity.TrustCenterAccess.UpdatedAt == nil {
break
}
return e.complexity.TrustCenterAccess.UpdatedAt(childComplexity), true
case "Vendor.category":
if e.complexity.Vendor.Category == nil {
break
@@ -552,6 +612,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
opCtx := graphql.GetOperationContext(ctx)
ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)}
inputUnmarshalMap := graphql.BuildUnmarshalerMap(
ec.unmarshalInputCreateTrustCenterAccessInput,
ec.unmarshalInputExportDocumentPDFInput,
)
first := true
@@ -732,7 +793,6 @@ type Audit implements Node {
id: ID!
framework: Framework! @goField(forceResolver: true)
report: Report @goField(forceResolver: true)
reportUrl: String @goField(forceResolver: true) @mustBeAuthenticated(role: USER)
}
type AuditConnection {
@@ -876,6 +936,24 @@ type TrustCenter implements Node {
): VendorConnection! @goField(forceResolver: true)
}
type TrustCenterAccess implements Node {
id: ID!
email: String!
name: String!
createdAt: Datetime!
updatedAt: Datetime!
}
input CreateTrustCenterAccessInput {
trustCenterId: ID!
email: String!
name: String!
}
type CreateTrustCenterAccessPayload {
trustCenterAccess: TrustCenterAccess!
}
input ExportDocumentPDFInput {
documentId: ID!
}
@@ -889,6 +967,10 @@ type Query {
}
type Mutation {
createTrustCenterAccess(
input: CreateTrustCenterAccessInput!
): CreateTrustCenterAccessPayload! @mustBeAuthenticated(role: NONE)
exportDocumentPDF(
input: ExportDocumentPDFInput!
): ExportDocumentPDFPayload! @mustBeAuthenticated(role: USER)
@@ -929,6 +1011,29 @@ func (ec *executionContext) dir_mustBeAuthenticated_argsRole(
return zeroVal, nil
}
func (ec *executionContext) field_Mutation_createTrustCenterAccess_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
arg0, err := ec.field_Mutation_createTrustCenterAccess_argsInput(ctx, rawArgs)
if err != nil {
return nil, err
}
args["input"] = arg0
return args, nil
}
func (ec *executionContext) field_Mutation_createTrustCenterAccess_argsInput(
ctx context.Context,
rawArgs map[string]any,
) (types.CreateTrustCenterAccessInput, error) {
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
if tmp, ok := rawArgs["input"]; ok {
return ec.unmarshalNCreateTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐCreateTrustCenterAccessInput(ctx, tmp)
}
var zeroVal types.CreateTrustCenterAccessInput
return zeroVal, nil
}
func (ec *executionContext) field_Mutation_exportDocumentPDF_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
@@ -1472,74 +1577,6 @@ func (ec *executionContext) fieldContext_Audit_report(_ context.Context, field g
return fc, nil
}
func (ec *executionContext) _Audit_reportUrl(ctx context.Context, field graphql.CollectedField, obj *types.Audit) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Audit_reportUrl(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
directive0 := func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Audit().ReportURL(rctx, obj)
}
directive1 := func(ctx context.Context) (any, error) {
role, err := ec.unmarshalORole2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐRole(ctx, "USER")
if err != nil {
var zeroVal *string
return zeroVal, err
}
if ec.directives.MustBeAuthenticated == nil {
var zeroVal *string
return zeroVal, errors.New("directive mustBeAuthenticated is not implemented")
}
return ec.directives.MustBeAuthenticated(ctx, obj, directive0, role)
}
tmp, err := directive1(rctx)
if err != nil {
return nil, graphql.ErrorOnPath(ctx, err)
}
if tmp == nil {
return nil, nil
}
if data, ok := tmp.(*string); ok {
return data, nil
}
return nil, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(*string)
fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Audit_reportUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Audit",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _AuditConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.AuditConnection) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_AuditConnection_edges(ctx, field)
if err != nil {
@@ -1733,8 +1770,6 @@ func (ec *executionContext) fieldContext_AuditEdge_node(_ context.Context, field
return ec.fieldContext_Audit_framework(ctx, field)
case "report":
return ec.fieldContext_Audit_report(ctx, field)
case "reportUrl":
return ec.fieldContext_Audit_reportUrl(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type Audit", field.Name)
},
@@ -1742,6 +1777,62 @@ func (ec *executionContext) fieldContext_AuditEdge_node(_ context.Context, field
return fc, nil
}
func (ec *executionContext) _CreateTrustCenterAccessPayload_trustCenterAccess(ctx context.Context, field graphql.CollectedField, obj *types.CreateTrustCenterAccessPayload) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_CreateTrustCenterAccessPayload_trustCenterAccess(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.TrustCenterAccess, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*types.TrustCenterAccess)
fc.Result = res
return ec.marshalNTrustCenterAccess2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐTrustCenterAccess(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_CreateTrustCenterAccessPayload_trustCenterAccess(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "CreateTrustCenterAccessPayload",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "id":
return ec.fieldContext_TrustCenterAccess_id(ctx, field)
case "email":
return ec.fieldContext_TrustCenterAccess_email(ctx, field)
case "name":
return ec.fieldContext_TrustCenterAccess_name(ctx, field)
case "createdAt":
return ec.fieldContext_TrustCenterAccess_createdAt(ctx, field)
case "updatedAt":
return ec.fieldContext_TrustCenterAccess_updatedAt(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type TrustCenterAccess", field.Name)
},
}
return fc, nil
}
func (ec *executionContext) _Document_id(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Document_id(ctx, field)
if err != nil {
@@ -2206,6 +2297,92 @@ func (ec *executionContext) fieldContext_Framework_name(_ context.Context, field
return fc, nil
}
func (ec *executionContext) _Mutation_createTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_createTrustCenterAccess(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
directive0 := func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().CreateTrustCenterAccess(rctx, fc.Args["input"].(types.CreateTrustCenterAccessInput))
}
directive1 := func(ctx context.Context) (any, error) {
role, err := ec.unmarshalORole2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐRole(ctx, "NONE")
if err != nil {
var zeroVal *types.CreateTrustCenterAccessPayload
return zeroVal, err
}
if ec.directives.MustBeAuthenticated == nil {
var zeroVal *types.CreateTrustCenterAccessPayload
return zeroVal, errors.New("directive mustBeAuthenticated is not implemented")
}
return ec.directives.MustBeAuthenticated(ctx, nil, directive0, role)
}
tmp, err := directive1(rctx)
if err != nil {
return nil, graphql.ErrorOnPath(ctx, err)
}
if tmp == nil {
return nil, nil
}
if data, ok := tmp.(*types.CreateTrustCenterAccessPayload); ok {
return data, nil
}
return nil, fmt.Errorf(`unexpected type %T from directive, should be *github.com/getprobo/probo/pkg/server/api/trust/v1/types.CreateTrustCenterAccessPayload`, tmp)
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*types.CreateTrustCenterAccessPayload)
fc.Result = res
return ec.marshalNCreateTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐCreateTrustCenterAccessPayload(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Mutation_createTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Mutation",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "trustCenterAccess":
return ec.fieldContext_CreateTrustCenterAccessPayload_trustCenterAccess(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type CreateTrustCenterAccessPayload", field.Name)
},
}
defer func() {
if r := recover(); r != nil {
err = ec.Recover(ctx, r)
ec.Error(ctx, err)
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
if fc.Args, err = ec.field_Mutation_createTrustCenterAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
ec.Error(ctx, err)
return fc, err
}
return fc, nil
}
func (ec *executionContext) _Mutation_exportDocumentPDF(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Mutation_exportDocumentPDF(ctx, field)
if err != nil {
@@ -3340,6 +3517,226 @@ func (ec *executionContext) fieldContext_TrustCenter_vendors(ctx context.Context
return fc, nil
}
func (ec *executionContext) _TrustCenterAccess_id(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TrustCenterAccess_id(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.ID, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(gid.GID)
fc.Result = res
return ec.marshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TrustCenterAccess_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TrustCenterAccess",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type ID does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TrustCenterAccess_email(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TrustCenterAccess_email(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Email, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TrustCenterAccess_email(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TrustCenterAccess",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TrustCenterAccess_name(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TrustCenterAccess_name(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TrustCenterAccess_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TrustCenterAccess",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type String does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TrustCenterAccess_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TrustCenterAccess_createdAt(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.CreatedAt, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(time.Time)
fc.Result = res
return ec.marshalNDatetime2timeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TrustCenterAccess_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TrustCenterAccess",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type Datetime does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _TrustCenterAccess_updatedAt(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_TrustCenterAccess_updatedAt(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children
return obj.UpdatedAt, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(time.Time)
fc.Result = res
return ec.marshalNDatetime2timeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_TrustCenterAccess_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TrustCenterAccess",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type Datetime does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _Vendor_id(ctx context.Context, field graphql.CollectedField, obj *types.Vendor) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Vendor_id(ctx, field)
if err != nil {
@@ -5709,6 +6106,47 @@ func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field
// region **************************** input.gotpl *****************************
func (ec *executionContext) unmarshalInputCreateTrustCenterAccessInput(ctx context.Context, obj any) (types.CreateTrustCenterAccessInput, error) {
var it types.CreateTrustCenterAccessInput
asMap := map[string]any{}
for k, v := range obj.(map[string]any) {
asMap[k] = v
}
fieldsInOrder := [...]string{"trustCenterId", "email", "name"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
continue
}
switch k {
case "trustCenterId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trustCenterId"))
data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
if err != nil {
return it, err
}
it.TrustCenterID = data
case "email":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email"))
data, err := ec.unmarshalNString2string(ctx, v)
if err != nil {
return it, err
}
it.Email = data
case "name":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
data, err := ec.unmarshalNString2string(ctx, v)
if err != nil {
return it, err
}
it.Name = data
}
}
return it, nil
}
func (ec *executionContext) unmarshalInputExportDocumentPDFInput(ctx context.Context, obj any) (types.ExportDocumentPDFInput, error) {
var it types.ExportDocumentPDFInput
asMap := map[string]any{}
@@ -5751,6 +6189,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj
return graphql.Null
}
return ec._Vendor(ctx, sel, obj)
case types.TrustCenterAccess:
return ec._TrustCenterAccess(ctx, sel, &obj)
case *types.TrustCenterAccess:
if obj == nil {
return graphql.Null
}
return ec._TrustCenterAccess(ctx, sel, obj)
case types.TrustCenter:
return ec._TrustCenter(ctx, sel, &obj)
case *types.TrustCenter:
@@ -5886,39 +6331,6 @@ func (ec *executionContext) _Audit(ctx context.Context, sel ast.SelectionSet, ob
continue
}
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
case "reportUrl":
field := field
innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
}
}()
res = ec._Audit_reportUrl(ctx, field, obj)
return res
}
if field.Deferrable != nil {
dfs, ok := deferred[field.Deferrable.Label]
di := 0
if ok {
dfs.AddField(field)
di = len(dfs.Values) - 1
} else {
dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
deferred[field.Deferrable.Label] = dfs
}
dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
return innerFunc(ctx, dfs)
})
// don't run the out.Concurrently() call below
out.Values[i] = graphql.Null
continue
}
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
default:
panic("unknown field " + strconv.Quote(field.Name))
@@ -6031,6 +6443,45 @@ func (ec *executionContext) _AuditEdge(ctx context.Context, sel ast.SelectionSet
return out
}
var createTrustCenterAccessPayloadImplementors = []string{"CreateTrustCenterAccessPayload"}
func (ec *executionContext) _CreateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *types.CreateTrustCenterAccessPayload) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, createTrustCenterAccessPayloadImplementors)
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
for i, field := range fields {
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("CreateTrustCenterAccessPayload")
case "trustCenterAccess":
out.Values[i] = ec._CreateTrustCenterAccessPayload_trustCenterAccess(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
default:
panic("unknown field " + strconv.Quote(field.Name))
}
}
out.Dispatch(ctx)
if out.Invalids > 0 {
return graphql.Null
}
atomic.AddInt32(&ec.deferred, int32(len(deferred)))
for label, dfs := range deferred {
ec.processDeferredGroup(graphql.DeferredGroup{
Label: label,
Path: graphql.GetPath(ctx),
FieldSet: dfs,
Context: ctx,
})
}
return out
}
var documentImplementors = []string{"Document", "Node"}
func (ec *executionContext) _Document(ctx context.Context, sel ast.SelectionSet, obj *types.Document) graphql.Marshaler {
@@ -6270,6 +6721,13 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("Mutation")
case "createTrustCenterAccess":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_createTrustCenterAccess(ctx, field)
})
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "exportDocumentPDF":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_exportDocumentPDF(ctx, field)
@@ -6764,6 +7222,65 @@ func (ec *executionContext) _TrustCenter(ctx context.Context, sel ast.SelectionS
return out
}
var trustCenterAccessImplementors = []string{"TrustCenterAccess", "Node"}
func (ec *executionContext) _TrustCenterAccess(ctx context.Context, sel ast.SelectionSet, obj *types.TrustCenterAccess) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, trustCenterAccessImplementors)
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
for i, field := range fields {
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("TrustCenterAccess")
case "id":
out.Values[i] = ec._TrustCenterAccess_id(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "email":
out.Values[i] = ec._TrustCenterAccess_email(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "name":
out.Values[i] = ec._TrustCenterAccess_name(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "createdAt":
out.Values[i] = ec._TrustCenterAccess_createdAt(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "updatedAt":
out.Values[i] = ec._TrustCenterAccess_updatedAt(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
default:
panic("unknown field " + strconv.Quote(field.Name))
}
}
out.Dispatch(ctx)
if out.Invalids > 0 {
return graphql.Null
}
atomic.AddInt32(&ec.deferred, int32(len(deferred)))
for label, dfs := range deferred {
ec.processDeferredGroup(graphql.DeferredGroup{
Label: label,
Path: graphql.GetPath(ctx),
FieldSet: dfs,
Context: ctx,
})
}
return out
}
var vendorImplementors = []string{"Vendor", "Node"}
func (ec *executionContext) _Vendor(ctx context.Context, sel ast.SelectionSet, obj *types.Vendor) graphql.Marshaler {
@@ -7334,6 +7851,25 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se
return res
}
func (ec *executionContext) unmarshalNCreateTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐCreateTrustCenterAccessInput(ctx context.Context, v any) (types.CreateTrustCenterAccessInput, error) {
res, err := ec.unmarshalInputCreateTrustCenterAccessInput(ctx, v)
return res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalNCreateTrustCenterAccessPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐCreateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v types.CreateTrustCenterAccessPayload) graphql.Marshaler {
return ec._CreateTrustCenterAccessPayload(ctx, sel, &v)
}
func (ec *executionContext) marshalNCreateTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐCreateTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v *types.CreateTrustCenterAccessPayload) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._CreateTrustCenterAccessPayload(ctx, sel, v)
}
func (ec *executionContext) unmarshalNCursorKey2githubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx context.Context, v any) (page.CursorKey, error) {
res, err := cursor.UnmarshalCursorKeyScalar(v)
return res, graphql.ErrorOnPath(ctx, err)
@@ -7350,6 +7886,22 @@ func (ec *executionContext) marshalNCursorKey2githubᚗcomᚋgetproboᚋproboᚋ
return res
}
func (ec *executionContext) unmarshalNDatetime2timeᚐTime(ctx context.Context, v any) (time.Time, error) {
res, err := graphql.UnmarshalTime(v)
return res, graphql.ErrorOnPath(ctx, err)
}
func (ec *executionContext) marshalNDatetime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler {
_ = sel
res := graphql.MarshalTime(v)
if res == graphql.Null {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
}
return res
}
func (ec *executionContext) marshalNDocument2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐDocument(ctx context.Context, sel ast.SelectionSet, v *types.Document) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
@@ -7547,6 +8099,16 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S
return res
}
func (ec *executionContext) marshalNTrustCenterAccess2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐTrustCenterAccess(ctx context.Context, sel ast.SelectionSet, v *types.TrustCenterAccess) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._TrustCenterAccess(ctx, sel, v)
}
func (ec *executionContext) marshalNVendor2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐVendor(ctx context.Context, sel ast.SelectionSet, v *types.Vendor) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {

View File

@@ -22,6 +22,8 @@ import (
"time"
"github.com/getprobo/probo/pkg/probo"
console_v1 "github.com/getprobo/probo/pkg/server/api/console/v1"
"github.com/getprobo/probo/pkg/server/session"
"github.com/getprobo/probo/pkg/statelesstoken"
"github.com/getprobo/probo/pkg/trust"
"go.gearno.de/kit/httpserver"
@@ -110,12 +112,16 @@ func validateTrustCenterAccessToken(ctx context.Context, trustSvc *trust.Service
tenantID := token.Data.TrustCenterID.TenantID()
tenantSvc := trustSvc.WithTenant(tenantID)
return tenantSvc.TrustCenterAccesses.ValidateToken(ctx, tokenString)
accessData, err := tenantSvc.TrustCenterAccesses.ValidateToken(ctx, tokenString)
if err != nil {
return nil, fmt.Errorf("cannot validate trust center access token: %w", err)
}
return accessData, nil
}
func trustCenterLogoutHandler(trustAuthCfg TrustAuthConfig) http.HandlerFunc {
func trustCenterLogoutHandler(authCfg console_v1.AuthConfig, trustAuthCfg TrustAuthConfig) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Clear cookie directly
http.SetCookie(w, &http.Cookie{
Name: trustAuthCfg.CookieName,
Value: "",
@@ -127,6 +133,11 @@ func trustCenterLogoutHandler(trustAuthCfg TrustAuthConfig) http.HandlerFunc {
SameSite: http.SameSiteStrictMode,
})
session.ClearCookie(w, session.AuthConfig{
CookieName: authCfg.CookieName,
CookieSecret: authCfg.CookieSecret,
})
httpserver.RenderJSON(w, http.StatusOK, map[string]string{
"message": "Logged out successfully",
})

View File

@@ -7,6 +7,7 @@ import (
"fmt"
"io"
"strconv"
"time"
"github.com/getprobo/probo/pkg/coredata"
"github.com/getprobo/probo/pkg/gid"
@@ -22,7 +23,6 @@ type Audit struct {
ID gid.GID `json:"id"`
Framework *Framework `json:"framework"`
Report *Report `json:"report,omitempty"`
ReportURL *string `json:"reportUrl,omitempty"`
}
func (Audit) IsNode() {}
@@ -38,6 +38,16 @@ type AuditEdge struct {
Node *Audit `json:"node"`
}
type CreateTrustCenterAccessInput struct {
TrustCenterID gid.GID `json:"trustCenterId"`
Email string `json:"email"`
Name string `json:"name"`
}
type CreateTrustCenterAccessPayload struct {
TrustCenterAccess *TrustCenterAccess `json:"trustCenterAccess"`
}
type Document struct {
ID gid.GID `json:"id"`
Title string `json:"title"`
@@ -117,6 +127,17 @@ type TrustCenter struct {
func (TrustCenter) IsNode() {}
func (this TrustCenter) GetID() gid.GID { return this.ID }
type TrustCenterAccess struct {
ID gid.GID `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
func (TrustCenterAccess) IsNode() {}
func (this TrustCenterAccess) GetID() gid.GID { return this.ID }
type Vendor struct {
ID gid.GID `json:"id"`
Name string `json:"name"`

View File

@@ -16,6 +16,7 @@ import (
"github.com/getprobo/probo/pkg/server/api/trust/v1/auth"
"github.com/getprobo/probo/pkg/server/api/trust/v1/schema"
"github.com/getprobo/probo/pkg/server/api/trust/v1/types"
"github.com/getprobo/probo/pkg/trust"
)
// Framework is the resolver for the framework field.
@@ -56,29 +57,28 @@ func (r *auditResolver) Report(ctx context.Context, obj *types.Audit) (*types.Re
return types.NewReport(report), nil
}
// ReportURL is the resolver for the reportUrl field.
func (r *auditResolver) ReportURL(ctx context.Context, obj *types.Audit) (*string, error) {
if err := auth.ValidateTenantAccess(ctx, r, userTenantContextKey, obj.ID.TenantID()); err != nil {
return nil, err
}
// CreateTrustCenterAccess is the resolver for the createTrustCenterAccess field.
func (r *mutationResolver) CreateTrustCenterAccess(ctx context.Context, input types.CreateTrustCenterAccessInput) (*types.CreateTrustCenterAccessPayload, error) {
trustSvc := r.trustCenterSvc.WithTenant(input.TrustCenterID.TenantID())
trust := r.TrustService(ctx, obj.ID.TenantID())
audit, err := trust.Audits.Get(ctx, obj.ID)
access, err := trustSvc.TrustCenterAccesses.Create(ctx, &trust.CreateTrustCenterAccessRequest{
TrustCenterID: input.TrustCenterID,
Email: input.Email,
Name: input.Name,
})
if err != nil {
return nil, fmt.Errorf("cannot load audit: %w", err)
panic(fmt.Errorf("cannot create trust center access: %w", err))
}
if audit.ReportID == nil {
return nil, nil
}
url, err := trust.Audits.GenerateReportURL(ctx, obj.ID, r.trustAuthCfg.ReportURLDuration)
if err != nil {
return nil, fmt.Errorf("cannot generate report URL: %w", err)
}
return url, nil
return &types.CreateTrustCenterAccessPayload{
TrustCenterAccess: &types.TrustCenterAccess{
ID: access.ID,
Email: access.Email,
Name: access.Name,
CreatedAt: access.CreatedAt,
UpdatedAt: access.UpdatedAt,
},
}, nil
}
// ExportDocumentPDF is the resolver for the exportDocumentPDF field.
@@ -140,7 +140,7 @@ func (r *reportResolver) DownloadURL(ctx context.Context, obj *types.Report) (*s
trust := r.TrustService(ctx, obj.ID.TenantID())
url, err := trust.Reports.GenerateDownloadURL(ctx, obj.ID, 5*time.Minute)
url, err := trust.Reports.GenerateDownloadURL(ctx, obj.ID, r.trustAuthCfg.ReportURLDuration)
if err != nil {
return nil, fmt.Errorf("cannot generate download URL: %w", err)
}