Clean trust center access
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -25,7 +25,6 @@ export const trustCenterAccessesQuery = graphql`
|
||||
id
|
||||
email
|
||||
name
|
||||
active
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
@@ -35,20 +34,6 @@ export const trustCenterAccessesQuery = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const revokeTrustCenterAccessMutation = graphql`
|
||||
mutation TrustCenterAccessGraphRevokeMutation($input: RevokeTrustCenterAccessInput!) {
|
||||
revokeTrustCenterAccess(input: $input) {
|
||||
trustCenterAccess {
|
||||
id
|
||||
email
|
||||
name
|
||||
active
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const createTrustCenterAccessMutation = graphql`
|
||||
mutation TrustCenterAccessGraphCreateMutation(
|
||||
$input: CreateTrustCenterAccessInput!
|
||||
@@ -61,7 +46,6 @@ export const createTrustCenterAccessMutation = graphql`
|
||||
id
|
||||
email
|
||||
name
|
||||
active
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
@@ -69,20 +53,6 @@ export const createTrustCenterAccessMutation = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const updateTrustCenterAccessMutation = graphql`
|
||||
mutation TrustCenterAccessGraphUpdateMutation($input: UpdateTrustCenterAccessInput!) {
|
||||
updateTrustCenterAccess(input: $input) {
|
||||
trustCenterAccess {
|
||||
id
|
||||
email
|
||||
name
|
||||
active
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const deleteTrustCenterAccessMutation = graphql`
|
||||
mutation TrustCenterAccessGraphDeleteMutation(
|
||||
$input: DeleteTrustCenterAccessInput!
|
||||
@@ -94,6 +64,15 @@ export const deleteTrustCenterAccessMutation = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
export function useTrustCenterAccesses(trustCenterId: string): TrustCenterAccessGraphQuery$data {
|
||||
return useLazyLoadQuery<TrustCenterAccessGraphQuery>(trustCenterAccessesQuery, { trustCenterId });
|
||||
export function useTrustCenterAccesses(trustCenterId: string): TrustCenterAccessGraphQuery$data | null {
|
||||
// Always call useLazyLoadQuery to maintain consistent hook order
|
||||
// Use a placeholder value when trustCenterId is empty
|
||||
const data = useLazyLoadQuery<TrustCenterAccessGraphQuery>(
|
||||
trustCenterAccessesQuery,
|
||||
{ trustCenterId: trustCenterId || "" },
|
||||
{ fetchPolicy: 'store-and-network' }
|
||||
);
|
||||
|
||||
// Return null if trustCenterId was empty, otherwise return the data
|
||||
return trustCenterId ? data : null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<79b53f51663ada6e9899523400d54996>>
|
||||
* @generated SignedSource<<08687dbafb5515e9d2073b292a05ea0c>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -12,7 +12,6 @@ import { ConcreteRequest } from 'relay-runtime';
|
||||
export type CreateTrustCenterAccessInput = {
|
||||
email: string;
|
||||
name: string;
|
||||
sendEmail?: boolean;
|
||||
trustCenterId: string;
|
||||
};
|
||||
export type TrustCenterAccessGraphCreateMutation$variables = {
|
||||
@@ -24,7 +23,6 @@ export type TrustCenterAccessGraphCreateMutation$data = {
|
||||
readonly trustCenterAccessEdge: {
|
||||
readonly cursor: any;
|
||||
readonly node: {
|
||||
readonly active: boolean;
|
||||
readonly createdAt: any;
|
||||
readonly email: string;
|
||||
readonly id: string;
|
||||
@@ -100,13 +98,6 @@ v3 = {
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "active",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -186,16 +177,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "eafddcd0263963235d3249c22eb50593",
|
||||
"cacheID": "86c21ac139bec74f2a4abad9caef68b1",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterAccessGraphCreateMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation TrustCenterAccessGraphCreateMutation(\n $input: CreateTrustCenterAccessInput!\n) {\n createTrustCenterAccess(input: $input) {\n trustCenterAccessEdge {\n cursor\n node {\n id\n email\n name\n active\n createdAt\n }\n }\n }\n}\n"
|
||||
"text": "mutation TrustCenterAccessGraphCreateMutation(\n $input: CreateTrustCenterAccessInput!\n) {\n createTrustCenterAccess(input: $input) {\n trustCenterAccessEdge {\n cursor\n node {\n id\n email\n name\n createdAt\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "99676fee0b2de06a92cdad66c577eee7";
|
||||
(node as any).hash = "59e0ab46fd6b68747566d666f5315292";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<2333a6a7d5415f1a08a5612dcaceee8f>>
|
||||
* @generated SignedSource<<cbee2b0f0f7bc70f542094f32bd1b91b>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -19,7 +19,6 @@ export type TrustCenterAccessGraphQuery$data = {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly cursor: any;
|
||||
readonly node: {
|
||||
readonly active: boolean;
|
||||
readonly createdAt: any;
|
||||
readonly email: string;
|
||||
readonly id: string;
|
||||
@@ -156,13 +155,6 @@ v5 = [
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "active",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -290,7 +282,7 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "5b83cd4ae2434ce2e00de7230d264432",
|
||||
"cacheID": "47681869f07fbe7df45ae3f663827c10",
|
||||
"id": null,
|
||||
"metadata": {
|
||||
"connection": [
|
||||
@@ -307,11 +299,11 @@ return {
|
||||
},
|
||||
"name": "TrustCenterAccessGraphQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query TrustCenterAccessGraphQuery(\n $trustCenterId: ID!\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n accesses(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n createdAt\n __typename\n }\n }\n }\n }\n id\n }\n}\n"
|
||||
"text": "query TrustCenterAccessGraphQuery(\n $trustCenterId: ID!\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n accesses(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n createdAt\n __typename\n }\n }\n }\n }\n id\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "af598fd2af198e63ed84fd618857a985";
|
||||
(node as any).hash = "06d7307ac23675de91ba2f9cb9d604bc";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/**
|
||||
* @generated SignedSource<<a234c36ae13e75cd1b0d893c4e232fc4>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type RevokeTrustCenterAccessInput = {
|
||||
accessId: string;
|
||||
};
|
||||
export type TrustCenterAccessGraphRevokeMutation$variables = {
|
||||
input: RevokeTrustCenterAccessInput;
|
||||
};
|
||||
export type TrustCenterAccessGraphRevokeMutation$data = {
|
||||
readonly revokeTrustCenterAccess: {
|
||||
readonly trustCenterAccess: {
|
||||
readonly active: boolean;
|
||||
readonly createdAt: any;
|
||||
readonly email: string;
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
export type TrustCenterAccessGraphRevokeMutation = {
|
||||
response: TrustCenterAccessGraphRevokeMutation$data;
|
||||
variables: TrustCenterAccessGraphRevokeMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"alias": null,
|
||||
"args": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
"concreteType": "RevokeTrustCenterAccessPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "revokeTrustCenterAccess",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenterAccess",
|
||||
"kind": "LinkedField",
|
||||
"name": "trustCenterAccess",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "email",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "active",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
];
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "TrustCenterAccessGraphRevokeMutation",
|
||||
"selections": (v1/*: any*/),
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "TrustCenterAccessGraphRevokeMutation",
|
||||
"selections": (v1/*: any*/)
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "b26927a2b8d02eb2e3754850b0a44d8b",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterAccessGraphRevokeMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation TrustCenterAccessGraphRevokeMutation(\n $input: RevokeTrustCenterAccessInput!\n) {\n revokeTrustCenterAccess(input: $input) {\n trustCenterAccess {\n id\n email\n name\n active\n createdAt\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "269cce2fe60fac04d807f1004ef0777f";
|
||||
|
||||
export default node;
|
||||
@@ -1,141 +0,0 @@
|
||||
/**
|
||||
* @generated SignedSource<<54ac79c4d292eb19f73bbf2363015dd9>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type UpdateTrustCenterAccessInput = {
|
||||
accessId: string;
|
||||
active?: boolean | null | undefined;
|
||||
email?: string | null | undefined;
|
||||
name?: string | null | undefined;
|
||||
sendEmail?: boolean;
|
||||
};
|
||||
export type TrustCenterAccessGraphUpdateMutation$variables = {
|
||||
input: UpdateTrustCenterAccessInput;
|
||||
};
|
||||
export type TrustCenterAccessGraphUpdateMutation$data = {
|
||||
readonly updateTrustCenterAccess: {
|
||||
readonly trustCenterAccess: {
|
||||
readonly active: boolean;
|
||||
readonly createdAt: any;
|
||||
readonly email: string;
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
export type TrustCenterAccessGraphUpdateMutation = {
|
||||
response: TrustCenterAccessGraphUpdateMutation$data;
|
||||
variables: TrustCenterAccessGraphUpdateMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"alias": null,
|
||||
"args": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
"concreteType": "UpdateTrustCenterAccessPayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "updateTrustCenterAccess",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenterAccess",
|
||||
"kind": "LinkedField",
|
||||
"name": "trustCenterAccess",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "email",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "active",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
];
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "TrustCenterAccessGraphUpdateMutation",
|
||||
"selections": (v1/*: any*/),
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "TrustCenterAccessGraphUpdateMutation",
|
||||
"selections": (v1/*: any*/)
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "8e284c8129de02d689385cae38cc3876",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterAccessGraphUpdateMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation TrustCenterAccessGraphUpdateMutation(\n $input: UpdateTrustCenterAccessInput!\n) {\n updateTrustCenterAccess(input: $input) {\n trustCenterAccess {\n id\n email\n name\n active\n createdAt\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "235754d40be56785bd0e7a36ac8c4ec2";
|
||||
|
||||
export default node;
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Badge, Button, Card, Dialog, DialogContent, DialogFooter, Field, Input, Spinner, Table, Tbody, Td, Th, Thead, Tr, useDialogRef, useToast, IconCheckmark1, IconCrossLargeX, IconTrashCan } from "@probo/ui";
|
||||
import { Button, Card, Dialog, DialogContent, DialogFooter, Field, Input, Spinner, Table, Tbody, Td, Th, Thead, Tr, useDialogRef, useToast, IconTrashCan } from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { useOutletContext } from "react-router";
|
||||
import { useState, useCallback } from "react";
|
||||
import {
|
||||
useTrustCenterAccesses,
|
||||
createTrustCenterAccessMutation,
|
||||
updateTrustCenterAccessMutation,
|
||||
deleteTrustCenterAccessMutation
|
||||
} from "/hooks/graph/TrustCenterAccessGraph";
|
||||
import { useMutation } from "react-relay";
|
||||
@@ -25,7 +24,6 @@ export default function TrustCenterAccessTab() {
|
||||
const { organization } = useOutletContext<ContextType>();
|
||||
|
||||
const [createInvitation, isCreating] = useMutation(createTrustCenterAccessMutation);
|
||||
const [updateInvitation, isUpdating] = useMutation(updateTrustCenterAccessMutation);
|
||||
const [deleteInvitation, isDeleting] = useMutation(deleteTrustCenterAccessMutation);
|
||||
|
||||
const dialogRef = useDialogRef();
|
||||
@@ -36,40 +34,17 @@ export default function TrustCenterAccessTab() {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
active: boolean;
|
||||
createdAt: Date;
|
||||
};
|
||||
};
|
||||
|
||||
const trustCenterData = useTrustCenterAccesses(organization.trustCenter?.id || "");
|
||||
|
||||
if (!organization.trustCenter?.id) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h3 className="text-base font-medium">{__("External Access")}</h3>
|
||||
<p className="text-sm text-txt-tertiary">
|
||||
{__("Manage who can access your trust center with time-limited tokens")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Card padded>
|
||||
<div className="text-center text-txt-tertiary py-8">
|
||||
<Spinner />
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const accesses: AccessType[] = trustCenterData?.node?.accesses?.edges ?
|
||||
trustCenterData.node.accesses.edges.map(edge => ({
|
||||
id: edge.node.id,
|
||||
email: edge.node.email,
|
||||
name: edge.node.name,
|
||||
active: edge.node.active,
|
||||
createdAt: new Date(edge.node.createdAt)
|
||||
})) : [];
|
||||
const accesses: AccessType[] = trustCenterData?.node?.accesses?.edges?.map(edge => ({
|
||||
id: edge.node.id,
|
||||
email: edge.node.email,
|
||||
name: edge.node.name,
|
||||
createdAt: new Date(edge.node.createdAt)
|
||||
})) ?? [];
|
||||
|
||||
const handleInvite = useCallback(async () => {
|
||||
if (!organization.trustCenter?.id) {
|
||||
@@ -99,7 +74,6 @@ export default function TrustCenterAccessTab() {
|
||||
trustCenterId: organization.trustCenter.id,
|
||||
email: email.trim(),
|
||||
name: name.trim(),
|
||||
sendEmail: true,
|
||||
},
|
||||
connections: connectionId ? [connectionId] : [],
|
||||
},
|
||||
@@ -142,84 +116,6 @@ export default function TrustCenterAccessTab() {
|
||||
}
|
||||
}, [organization.trustCenter?.id, email, name, trustCenterData, createInvitation, toast, __, dialogRef]);
|
||||
|
||||
const handleRevoke = useCallback(async (accessId: string) => {
|
||||
updateInvitation({
|
||||
variables: {
|
||||
input: {
|
||||
accessId,
|
||||
active: false,
|
||||
sendEmail: false,
|
||||
},
|
||||
},
|
||||
onCompleted: () => {
|
||||
toast({
|
||||
title: __("Success"),
|
||||
description: __("Access revoked successfully"),
|
||||
variant: "success",
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: error.message,
|
||||
variant: "error",
|
||||
});
|
||||
},
|
||||
});
|
||||
}, [updateInvitation, toast, __]);
|
||||
|
||||
const handleReinvite = useCallback(async (access: AccessType) => {
|
||||
if (!organization.trustCenter?.id) {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: __("Trust center not found"),
|
||||
variant: "error",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
updateInvitation({
|
||||
variables: {
|
||||
input: {
|
||||
accessId: access.id,
|
||||
active: true,
|
||||
sendEmail: true,
|
||||
},
|
||||
},
|
||||
onCompleted: (_, errors) => {
|
||||
if (errors && errors.length > 0) {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: errors[0]?.message || __("Failed to send reinvitation"),
|
||||
variant: "error",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
toast({
|
||||
title: __("Success"),
|
||||
description: __("Reinvitation sent successfully"),
|
||||
variant: "success",
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: error.message || __("Failed to send reinvitation. Please try again."),
|
||||
variant: "error",
|
||||
});
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: __("An unexpected error occurred. Please try again."),
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
}, [organization.trustCenter?.id, updateInvitation, toast, __]);
|
||||
|
||||
const handleDelete = useCallback(async (accessId: string) => {
|
||||
const connectionId = trustCenterData?.node?.accesses?.__id;
|
||||
|
||||
@@ -256,13 +152,19 @@ export default function TrustCenterAccessTab() {
|
||||
{__("Manage who can access your trust center with time-limited tokens")}
|
||||
</p>
|
||||
</div>
|
||||
<Button onClick={() => dialogRef.current?.open()}>
|
||||
{__("Invite")}
|
||||
</Button>
|
||||
{organization.trustCenter?.id && (
|
||||
<Button onClick={() => dialogRef.current?.open()}>
|
||||
{__("Invite")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Card padded>
|
||||
{accesses.length === 0 ? (
|
||||
{!organization.trustCenter?.id ? (
|
||||
<div className="text-center text-txt-tertiary py-8">
|
||||
<Spinner />
|
||||
</div>
|
||||
) : accesses.length === 0 ? (
|
||||
<div className="text-center text-txt-tertiary py-8">
|
||||
{__("No external access granted yet")}
|
||||
</div>
|
||||
@@ -272,7 +174,6 @@ export default function TrustCenterAccessTab() {
|
||||
<Tr>
|
||||
<Th>{__("Name")}</Th>
|
||||
<Th>{__("Email")}</Th>
|
||||
<Th>{__("Status")}</Th>
|
||||
<Th>{__("Date")}</Th>
|
||||
<Th></Th>
|
||||
</Tr>
|
||||
@@ -282,22 +183,11 @@ export default function TrustCenterAccessTab() {
|
||||
<Tr key={access.id}>
|
||||
<Td className="font-medium">{access.name}</Td>
|
||||
<Td>{access.email}</Td>
|
||||
<Td>
|
||||
<Badge variant={access.active ? "success" : "neutral"}>
|
||||
{access.active ? __("Active") : __("Revoked")}
|
||||
</Badge>
|
||||
</Td>
|
||||
<Td>
|
||||
{access.createdAt.toLocaleDateString()}
|
||||
</Td>
|
||||
<Td noLink width={120} className="text-end">
|
||||
<div className="flex gap-2 justify-end">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => access.active ? handleRevoke(access.id) : handleReinvite(access)}
|
||||
disabled={isUpdating}
|
||||
icon={access.active ? IconCrossLargeX : IconCheckmark1}
|
||||
/>
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => handleDelete(access.id)}
|
||||
|
||||
@@ -4,7 +4,6 @@ CREATE TABLE trust_center_accesses (
|
||||
trust_center_id TEXT NOT NULL REFERENCES trust_centers(id) ON DELETE CASCADE,
|
||||
email CITEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
active BOOLEAN NOT NULL DEFAULT true,
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
UNIQUE(trust_center_id, email)
|
||||
|
||||
@@ -33,7 +33,6 @@ type (
|
||||
TrustCenterID gid.GID `db:"trust_center_id"`
|
||||
Email string `db:"email"`
|
||||
Name string `db:"name"`
|
||||
Active bool `db:"active"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
@@ -63,7 +62,6 @@ SELECT
|
||||
trust_center_id,
|
||||
email,
|
||||
name,
|
||||
active,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
@@ -108,7 +106,6 @@ SELECT
|
||||
trust_center_id,
|
||||
email,
|
||||
name,
|
||||
active,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
@@ -155,7 +152,6 @@ INSERT INTO trust_center_accesses (
|
||||
trust_center_id,
|
||||
email,
|
||||
name,
|
||||
active,
|
||||
created_at,
|
||||
updated_at
|
||||
) VALUES (
|
||||
@@ -164,7 +160,6 @@ INSERT INTO trust_center_accesses (
|
||||
@trust_center_id,
|
||||
@email,
|
||||
@name,
|
||||
@active,
|
||||
@created_at,
|
||||
@updated_at
|
||||
)
|
||||
@@ -176,7 +171,6 @@ INSERT INTO trust_center_accesses (
|
||||
"trust_center_id": tca.TrustCenterID,
|
||||
"email": tca.Email,
|
||||
"name": tca.Name,
|
||||
"active": tca.Active,
|
||||
"created_at": tca.CreatedAt,
|
||||
"updated_at": tca.UpdatedAt,
|
||||
}
|
||||
@@ -189,38 +183,6 @@ INSERT INTO trust_center_accesses (
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tca *TrustCenterAccess) Update(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
) error {
|
||||
q := `
|
||||
UPDATE trust_center_accesses
|
||||
SET
|
||||
active = @active,
|
||||
updated_at = @updated_at
|
||||
WHERE
|
||||
%s
|
||||
AND id = @id
|
||||
`
|
||||
|
||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{
|
||||
"id": tca.ID,
|
||||
"active": tca.Active,
|
||||
"updated_at": tca.UpdatedAt,
|
||||
}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
_, err := conn.Exec(ctx, q, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot update trust center access: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tca *TrustCenterAccess) Delete(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
@@ -262,7 +224,6 @@ SELECT
|
||||
trust_center_id,
|
||||
email,
|
||||
name,
|
||||
active,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
|
||||
@@ -39,25 +39,12 @@ type (
|
||||
TrustCenterID gid.GID
|
||||
Email string
|
||||
Name string
|
||||
SendEmail bool
|
||||
}
|
||||
|
||||
UpdateTrustCenterAccessRequest struct {
|
||||
AccessID gid.GID
|
||||
Email *string
|
||||
Name *string
|
||||
Active *bool
|
||||
SendEmail bool
|
||||
}
|
||||
|
||||
DeleteTrustCenterAccessRequest struct {
|
||||
AccessID gid.GID
|
||||
}
|
||||
|
||||
RevokeTrustCenterAccessRequest struct {
|
||||
AccessID gid.GID
|
||||
}
|
||||
|
||||
TrustCenterAccessData struct {
|
||||
TrustCenterID gid.GID `json:"trust_center_id"`
|
||||
Email string `json:"email"`
|
||||
@@ -68,34 +55,6 @@ const (
|
||||
TokenTypeTrustCenterAccess = "trust_center_access"
|
||||
)
|
||||
|
||||
func (s TrustCenterAccessService) RevokeAccess(
|
||||
ctx context.Context,
|
||||
req *RevokeTrustCenterAccessRequest,
|
||||
) (*coredata.TrustCenterAccess, error) {
|
||||
access := &coredata.TrustCenterAccess{}
|
||||
|
||||
err := s.svc.pg.WithTx(ctx, func(tx pg.Conn) error {
|
||||
if err := access.LoadByID(ctx, tx, s.svc.scope, req.AccessID); err != nil {
|
||||
return fmt.Errorf("cannot load trust center access: %w", err)
|
||||
}
|
||||
|
||||
access.Active = false
|
||||
access.UpdatedAt = time.Now()
|
||||
|
||||
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot update trust center access: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return access, nil
|
||||
}
|
||||
|
||||
func (s TrustCenterAccessService) ListForTrustCenterID(
|
||||
ctx context.Context,
|
||||
trustCenterID gid.GID,
|
||||
@@ -136,30 +95,9 @@ func (s TrustCenterAccessService) ValidateToken(
|
||||
return nil, fmt.Errorf("access not found or revoked: %w", err)
|
||||
}
|
||||
|
||||
if !access.Active {
|
||||
return nil, fmt.Errorf("access has been revoked")
|
||||
}
|
||||
|
||||
return &token.Data, nil
|
||||
}
|
||||
|
||||
func (s TrustCenterAccessService) IsAccessActive(
|
||||
ctx context.Context,
|
||||
trustCenterID gid.GID,
|
||||
email string,
|
||||
) (bool, error) {
|
||||
access := &coredata.TrustCenterAccess{}
|
||||
err := s.svc.pg.WithConn(ctx, func(conn pg.Conn) error {
|
||||
return access.LoadByTrustCenterIDAndEmail(ctx, conn, s.svc.scope, trustCenterID, email)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("cannot load trust center access: %w", err)
|
||||
}
|
||||
|
||||
return access.Active, nil
|
||||
}
|
||||
|
||||
func (s TrustCenterAccessService) Create(
|
||||
ctx context.Context,
|
||||
req *CreateTrustCenterAccessRequest,
|
||||
@@ -174,93 +112,31 @@ func (s TrustCenterAccessService) Create(
|
||||
|
||||
now := time.Now()
|
||||
|
||||
existingAccess := &coredata.TrustCenterAccess{}
|
||||
err := s.svc.pg.WithConn(ctx, func(conn pg.Conn) error {
|
||||
return existingAccess.LoadByTrustCenterIDAndEmail(ctx, conn, s.svc.scope, req.TrustCenterID, req.Email)
|
||||
})
|
||||
|
||||
var access *coredata.TrustCenterAccess
|
||||
|
||||
if err == nil {
|
||||
access = existingAccess
|
||||
access.Name = req.Name
|
||||
access.Active = true
|
||||
access.UpdatedAt = now
|
||||
err := s.svc.pg.WithTx(ctx, func(tx pg.Conn) error {
|
||||
existingAccess := &coredata.TrustCenterAccess{}
|
||||
err := existingAccess.LoadByTrustCenterIDAndEmail(ctx, tx, s.svc.scope, req.TrustCenterID, req.Email)
|
||||
|
||||
err = s.svc.pg.WithTx(ctx, func(tx pg.Conn) error {
|
||||
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot update trust center access: %w", err)
|
||||
if err == nil {
|
||||
// Access already exists, delete it
|
||||
if err := existingAccess.Delete(ctx, tx, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot delete existing trust center access: %w", err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
|
||||
access = &coredata.TrustCenterAccess{
|
||||
ID: gid.New(s.svc.scope.GetTenantID(), coredata.TrustCenterAccessEntityType),
|
||||
TenantID: s.svc.scope.GetTenantID(),
|
||||
TrustCenterID: req.TrustCenterID,
|
||||
Email: req.Email,
|
||||
Name: req.Name,
|
||||
Active: true,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
|
||||
err = s.svc.pg.WithTx(ctx, func(tx pg.Conn) error {
|
||||
if err := access.Insert(ctx, tx, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot insert trust center access: %w", err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if req.SendEmail {
|
||||
if err := s.sendAccessEmail(ctx, access); err != nil {
|
||||
fmt.Printf("Failed to send access email\n")
|
||||
}
|
||||
}
|
||||
|
||||
return access, nil
|
||||
}
|
||||
|
||||
func (s TrustCenterAccessService) Update(
|
||||
ctx context.Context,
|
||||
req *UpdateTrustCenterAccessRequest,
|
||||
) (*coredata.TrustCenterAccess, error) {
|
||||
access := &coredata.TrustCenterAccess{}
|
||||
|
||||
err := s.svc.pg.WithTx(ctx, func(tx pg.Conn) error {
|
||||
if err := access.LoadByID(ctx, tx, s.svc.scope, req.AccessID); err != nil {
|
||||
return fmt.Errorf("cannot load trust center access: %w", err)
|
||||
}
|
||||
|
||||
if req.Email != nil {
|
||||
if !strings.Contains(*req.Email, "@") {
|
||||
return fmt.Errorf("invalid email address")
|
||||
}
|
||||
access.Email = *req.Email
|
||||
}
|
||||
|
||||
if req.Name != nil {
|
||||
if *req.Name == "" {
|
||||
return fmt.Errorf("name cannot be empty")
|
||||
}
|
||||
access.Name = *req.Name
|
||||
}
|
||||
|
||||
if req.Active != nil {
|
||||
access.Active = *req.Active
|
||||
}
|
||||
|
||||
access.UpdatedAt = time.Now()
|
||||
|
||||
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot update trust center access: %w", err)
|
||||
if err := access.Insert(ctx, tx, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot insert trust center access: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -270,10 +146,8 @@ func (s TrustCenterAccessService) Update(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if req.SendEmail && access.Active {
|
||||
if err := s.sendAccessEmail(ctx, access); err != nil {
|
||||
fmt.Printf("Failed to send access email\n")
|
||||
}
|
||||
if err := s.sendAccessEmail(ctx, access); err != nil {
|
||||
fmt.Printf("Failed to send access email\n")
|
||||
}
|
||||
|
||||
return access, nil
|
||||
|
||||
@@ -1239,7 +1239,6 @@ type TrustCenterAccess implements Node {
|
||||
id: ID!
|
||||
email: String!
|
||||
name: String!
|
||||
active: Boolean!
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
@@ -1484,19 +1483,11 @@ type Mutation {
|
||||
input: UpdateTrustCenterInput!
|
||||
): UpdateTrustCenterPayload!
|
||||
|
||||
revokeTrustCenterAccess(
|
||||
input: RevokeTrustCenterAccessInput!
|
||||
): RevokeTrustCenterAccessPayload!
|
||||
|
||||
# Trust Center Access CRUD mutations
|
||||
createTrustCenterAccess(
|
||||
input: CreateTrustCenterAccessInput!
|
||||
): CreateTrustCenterAccessPayload!
|
||||
|
||||
updateTrustCenterAccess(
|
||||
input: UpdateTrustCenterAccessInput!
|
||||
): UpdateTrustCenterAccessPayload!
|
||||
|
||||
deleteTrustCenterAccess(
|
||||
input: DeleteTrustCenterAccessInput!
|
||||
): DeleteTrustCenterAccessPayload!
|
||||
@@ -1673,23 +1664,10 @@ input UpdateTrustCenterInput {
|
||||
slug: String
|
||||
}
|
||||
|
||||
input RevokeTrustCenterAccessInput {
|
||||
accessId: ID!
|
||||
}
|
||||
|
||||
input CreateTrustCenterAccessInput {
|
||||
trustCenterId: ID!
|
||||
email: String!
|
||||
name: String!
|
||||
sendEmail: Boolean! = true
|
||||
}
|
||||
|
||||
input UpdateTrustCenterAccessInput {
|
||||
accessId: ID!
|
||||
email: String
|
||||
name: String
|
||||
active: Boolean
|
||||
sendEmail: Boolean! = false
|
||||
}
|
||||
|
||||
input DeleteTrustCenterAccessInput {
|
||||
@@ -2063,18 +2041,10 @@ type UpdateTrustCenterPayload {
|
||||
|
||||
|
||||
|
||||
type RevokeTrustCenterAccessPayload {
|
||||
trustCenterAccess: TrustCenterAccess!
|
||||
}
|
||||
|
||||
type CreateTrustCenterAccessPayload {
|
||||
trustCenterAccessEdge: TrustCenterAccessEdge!
|
||||
}
|
||||
|
||||
type UpdateTrustCenterAccessPayload {
|
||||
trustCenterAccess: TrustCenterAccess!
|
||||
}
|
||||
|
||||
type DeleteTrustCenterAccessPayload {
|
||||
deletedTrustCenterAccessId: ID!
|
||||
}
|
||||
|
||||
@@ -618,7 +618,6 @@ type ComplexityRoot struct {
|
||||
RemoveUser func(childComplexity int, input types.RemoveUserInput) int
|
||||
RequestEvidence func(childComplexity int, input types.RequestEvidenceInput) int
|
||||
RequestSignature func(childComplexity int, input types.RequestSignatureInput) int
|
||||
RevokeTrustCenterAccess func(childComplexity int, input types.RevokeTrustCenterAccessInput) int
|
||||
SendSigningNotifications func(childComplexity int, input types.SendSigningNotificationsInput) int
|
||||
UnassignTask func(childComplexity int, input types.UnassignTaskInput) int
|
||||
UpdateAsset func(childComplexity int, input types.UpdateAssetInput) int
|
||||
@@ -634,7 +633,6 @@ 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
|
||||
UploadAuditReport func(childComplexity int, input types.UploadAuditReportInput) int
|
||||
UploadMeasureEvidence func(childComplexity int, input types.UploadMeasureEvidenceInput) int
|
||||
@@ -739,10 +737,6 @@ type ComplexityRoot struct {
|
||||
DocumentVersionSignatureEdge func(childComplexity int) int
|
||||
}
|
||||
|
||||
RevokeTrustCenterAccessPayload struct {
|
||||
TrustCenterAccess func(childComplexity int) int
|
||||
}
|
||||
|
||||
Risk struct {
|
||||
Category func(childComplexity int) int
|
||||
Controls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) int
|
||||
@@ -822,7 +816,6 @@ 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
|
||||
@@ -902,10 +895,6 @@ type ComplexityRoot struct {
|
||||
Task func(childComplexity int) int
|
||||
}
|
||||
|
||||
UpdateTrustCenterAccessPayload struct {
|
||||
TrustCenterAccess func(childComplexity int) int
|
||||
}
|
||||
|
||||
UpdateTrustCenterPayload struct {
|
||||
TrustCenter func(childComplexity int) int
|
||||
}
|
||||
@@ -1129,9 +1118,7 @@ type MutationResolver interface {
|
||||
CreateOrganization(ctx context.Context, input types.CreateOrganizationInput) (*types.CreateOrganizationPayload, error)
|
||||
UpdateOrganization(ctx context.Context, input types.UpdateOrganizationInput) (*types.UpdateOrganizationPayload, error)
|
||||
UpdateTrustCenter(ctx context.Context, input types.UpdateTrustCenterInput) (*types.UpdateTrustCenterPayload, error)
|
||||
RevokeTrustCenterAccess(ctx context.Context, input types.RevokeTrustCenterAccessInput) (*types.RevokeTrustCenterAccessPayload, 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)
|
||||
@@ -3596,18 +3583,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
||||
|
||||
return e.complexity.Mutation.RequestSignature(childComplexity, args["input"].(types.RequestSignatureInput)), true
|
||||
|
||||
case "Mutation.revokeTrustCenterAccess":
|
||||
if e.complexity.Mutation.RevokeTrustCenterAccess == nil {
|
||||
break
|
||||
}
|
||||
|
||||
args, err := ec.field_Mutation_revokeTrustCenterAccess_args(ctx, rawArgs)
|
||||
if err != nil {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
return e.complexity.Mutation.RevokeTrustCenterAccess(childComplexity, args["input"].(types.RevokeTrustCenterAccessInput)), true
|
||||
|
||||
case "Mutation.sendSigningNotifications":
|
||||
if e.complexity.Mutation.SendSigningNotifications == nil {
|
||||
break
|
||||
@@ -3788,18 +3763,6 @@ 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
|
||||
@@ -4341,13 +4304,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
||||
|
||||
return e.complexity.RequestSignaturePayload.DocumentVersionSignatureEdge(childComplexity), true
|
||||
|
||||
case "RevokeTrustCenterAccessPayload.trustCenterAccess":
|
||||
if e.complexity.RevokeTrustCenterAccessPayload.TrustCenterAccess == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.RevokeTrustCenterAccessPayload.TrustCenterAccess(childComplexity), true
|
||||
|
||||
case "Risk.category":
|
||||
if e.complexity.Risk.Category == nil {
|
||||
break
|
||||
@@ -4730,13 +4686,6 @@ 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
|
||||
@@ -4919,13 +4868,6 @@ 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
|
||||
@@ -5560,7 +5502,6 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
|
||||
ec.unmarshalInputRemoveUserInput,
|
||||
ec.unmarshalInputRequestEvidenceInput,
|
||||
ec.unmarshalInputRequestSignatureInput,
|
||||
ec.unmarshalInputRevokeTrustCenterAccessInput,
|
||||
ec.unmarshalInputRiskFilter,
|
||||
ec.unmarshalInputRiskOrder,
|
||||
ec.unmarshalInputSendSigningNotificationsInput,
|
||||
@@ -5580,7 +5521,6 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
|
||||
ec.unmarshalInputUpdatePeopleInput,
|
||||
ec.unmarshalInputUpdateRiskInput,
|
||||
ec.unmarshalInputUpdateTaskInput,
|
||||
ec.unmarshalInputUpdateTrustCenterAccessInput,
|
||||
ec.unmarshalInputUpdateTrustCenterInput,
|
||||
ec.unmarshalInputUpdateVendorInput,
|
||||
ec.unmarshalInputUploadAuditReportInput,
|
||||
@@ -6929,7 +6869,6 @@ type TrustCenterAccess implements Node {
|
||||
id: ID!
|
||||
email: String!
|
||||
name: String!
|
||||
active: Boolean!
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
}
|
||||
@@ -7174,19 +7113,11 @@ type Mutation {
|
||||
input: UpdateTrustCenterInput!
|
||||
): UpdateTrustCenterPayload!
|
||||
|
||||
revokeTrustCenterAccess(
|
||||
input: RevokeTrustCenterAccessInput!
|
||||
): RevokeTrustCenterAccessPayload!
|
||||
|
||||
# Trust Center Access CRUD mutations
|
||||
createTrustCenterAccess(
|
||||
input: CreateTrustCenterAccessInput!
|
||||
): CreateTrustCenterAccessPayload!
|
||||
|
||||
updateTrustCenterAccess(
|
||||
input: UpdateTrustCenterAccessInput!
|
||||
): UpdateTrustCenterAccessPayload!
|
||||
|
||||
deleteTrustCenterAccess(
|
||||
input: DeleteTrustCenterAccessInput!
|
||||
): DeleteTrustCenterAccessPayload!
|
||||
@@ -7363,23 +7294,10 @@ input UpdateTrustCenterInput {
|
||||
slug: String
|
||||
}
|
||||
|
||||
input RevokeTrustCenterAccessInput {
|
||||
accessId: ID!
|
||||
}
|
||||
|
||||
input CreateTrustCenterAccessInput {
|
||||
trustCenterId: ID!
|
||||
email: String!
|
||||
name: String!
|
||||
sendEmail: Boolean! = true
|
||||
}
|
||||
|
||||
input UpdateTrustCenterAccessInput {
|
||||
accessId: ID!
|
||||
email: String
|
||||
name: String
|
||||
active: Boolean
|
||||
sendEmail: Boolean! = false
|
||||
}
|
||||
|
||||
input DeleteTrustCenterAccessInput {
|
||||
@@ -7753,18 +7671,10 @@ type UpdateTrustCenterPayload {
|
||||
|
||||
|
||||
|
||||
type RevokeTrustCenterAccessPayload {
|
||||
trustCenterAccess: TrustCenterAccess!
|
||||
}
|
||||
|
||||
type CreateTrustCenterAccessPayload {
|
||||
trustCenterAccessEdge: TrustCenterAccessEdge!
|
||||
}
|
||||
|
||||
type UpdateTrustCenterAccessPayload {
|
||||
trustCenterAccess: TrustCenterAccess!
|
||||
}
|
||||
|
||||
type DeleteTrustCenterAccessPayload {
|
||||
deletedTrustCenterAccessId: ID!
|
||||
}
|
||||
@@ -10895,29 +10805,6 @@ func (ec *executionContext) field_Mutation_requestSignature_argsInput(
|
||||
return zeroVal, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) field_Mutation_revokeTrustCenterAccess_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
||||
var err error
|
||||
args := map[string]any{}
|
||||
arg0, err := ec.field_Mutation_revokeTrustCenterAccess_argsInput(ctx, rawArgs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
args["input"] = arg0
|
||||
return args, nil
|
||||
}
|
||||
func (ec *executionContext) field_Mutation_revokeTrustCenterAccess_argsInput(
|
||||
ctx context.Context,
|
||||
rawArgs map[string]any,
|
||||
) (types.RevokeTrustCenterAccessInput, error) {
|
||||
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
|
||||
if tmp, ok := rawArgs["input"]; ok {
|
||||
return ec.unmarshalNRevokeTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessInput(ctx, tmp)
|
||||
}
|
||||
|
||||
var zeroVal types.RevokeTrustCenterAccessInput
|
||||
return zeroVal, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) field_Mutation_sendSigningNotifications_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
||||
var err error
|
||||
args := map[string]any{}
|
||||
@@ -11240,29 +11127,6 @@ 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{}
|
||||
@@ -25285,65 +25149,6 @@ func (ec *executionContext) fieldContext_Mutation_updateTrustCenter(ctx context.
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Mutation_revokeTrustCenterAccess(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Mutation_revokeTrustCenterAccess(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().RevokeTrustCenterAccess(rctx, fc.Args["input"].(types.RevokeTrustCenterAccessInput))
|
||||
})
|
||||
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.RevokeTrustCenterAccessPayload)
|
||||
fc.Result = res
|
||||
return ec.marshalNRevokeTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessPayload(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Mutation_revokeTrustCenterAccess(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_RevokeTrustCenterAccessPayload_trustCenterAccess(ctx, field)
|
||||
}
|
||||
return nil, fmt.Errorf("no field named %q was found under type RevokeTrustCenterAccessPayload", 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_revokeTrustCenterAccess_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return fc, err
|
||||
}
|
||||
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 {
|
||||
@@ -25403,65 +25208,6 @@ 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 {
|
||||
@@ -32787,64 +32533,6 @@ func (ec *executionContext) fieldContext_RequestSignaturePayload_documentVersion
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _RevokeTrustCenterAccessPayload_trustCenterAccess(ctx context.Context, field graphql.CollectedField, obj *types.RevokeTrustCenterAccessPayload) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_RevokeTrustCenterAccessPayload_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_RevokeTrustCenterAccessPayload_trustCenterAccess(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "RevokeTrustCenterAccessPayload",
|
||||
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) _Risk_id(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Risk_id(ctx, field)
|
||||
if err != nil {
|
||||
@@ -35585,50 +35273,6 @@ 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 {
|
||||
@@ -35910,8 +35554,6 @@ 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":
|
||||
@@ -37041,64 +36683,6 @@ 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 {
|
||||
@@ -44180,11 +43764,7 @@ func (ec *executionContext) unmarshalInputCreateTrustCenterAccessInput(ctx conte
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
if _, present := asMap["sendEmail"]; !present {
|
||||
asMap["sendEmail"] = true
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"trustCenterId", "email", "name", "sendEmail"}
|
||||
fieldsInOrder := [...]string{"trustCenterId", "email", "name"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -44212,13 +43792,6 @@ func (ec *executionContext) unmarshalInputCreateTrustCenterAccessInput(ctx conte
|
||||
return it, err
|
||||
}
|
||||
it.Name = data
|
||||
case "sendEmail":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sendEmail"))
|
||||
data, err := ec.unmarshalNBoolean2bool(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.SendEmail = data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45783,33 +45356,6 @@ func (ec *executionContext) unmarshalInputRequestSignatureInput(ctx context.Cont
|
||||
return it, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalInputRevokeTrustCenterAccessInput(ctx context.Context, obj any) (types.RevokeTrustCenterAccessInput, error) {
|
||||
var it types.RevokeTrustCenterAccessInput
|
||||
asMap := map[string]any{}
|
||||
for k, v := range obj.(map[string]any) {
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"accessId"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
switch k {
|
||||
case "accessId":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("accessId"))
|
||||
data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.AccessID = data
|
||||
}
|
||||
}
|
||||
|
||||
return it, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalInputRiskFilter(ctx context.Context, obj any) (types.RiskFilter, error) {
|
||||
var it types.RiskFilter
|
||||
asMap := map[string]any{}
|
||||
@@ -46743,65 +46289,6 @@ 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
|
||||
}
|
||||
|
||||
if _, present := asMap["sendEmail"]; !present {
|
||||
asMap["sendEmail"] = false
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"accessId", "email", "name", "active", "sendEmail"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
switch k {
|
||||
case "accessId":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("accessId"))
|
||||
data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.AccessID = data
|
||||
case "email":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("email"))
|
||||
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.Email = 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
|
||||
case "sendEmail":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sendEmail"))
|
||||
data, err := ec.unmarshalNBoolean2bool(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.SendEmail = data
|
||||
}
|
||||
}
|
||||
|
||||
return it, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalInputUpdateTrustCenterInput(ctx context.Context, obj any) (types.UpdateTrustCenterInput, error) {
|
||||
var it types.UpdateTrustCenterInput
|
||||
asMap := map[string]any{}
|
||||
@@ -52788,13 +52275,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "revokeTrustCenterAccess":
|
||||
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
||||
return ec._Mutation_revokeTrustCenterAccess(ctx, field)
|
||||
})
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
}
|
||||
case "createTrustCenterAccess":
|
||||
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
|
||||
return ec._Mutation_createTrustCenterAccess(ctx, field)
|
||||
@@ -52802,13 +52282,6 @@ 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)
|
||||
@@ -54631,45 +54104,6 @@ func (ec *executionContext) _RequestSignaturePayload(ctx context.Context, sel as
|
||||
return out
|
||||
}
|
||||
|
||||
var revokeTrustCenterAccessPayloadImplementors = []string{"RevokeTrustCenterAccessPayload"}
|
||||
|
||||
func (ec *executionContext) _RevokeTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, obj *types.RevokeTrustCenterAccessPayload) graphql.Marshaler {
|
||||
fields := graphql.CollectFields(ec.OperationContext, sel, revokeTrustCenterAccessPayloadImplementors)
|
||||
|
||||
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("RevokeTrustCenterAccessPayload")
|
||||
case "trustCenterAccess":
|
||||
out.Values[i] = ec._RevokeTrustCenterAccessPayload_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 riskImplementors = []string{"Risk", "Node"}
|
||||
|
||||
func (ec *executionContext) _Risk(ctx context.Context, sel ast.SelectionSet, obj *types.Risk) graphql.Marshaler {
|
||||
@@ -55645,11 +55079,6 @@ 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 {
|
||||
@@ -56366,45 +55795,6 @@ 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 {
|
||||
@@ -61114,25 +60504,6 @@ func (ec *executionContext) marshalNRequestSignaturePayload2ᚖgithubᚗcomᚋge
|
||||
return ec._RequestSignaturePayload(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNRevokeTrustCenterAccessInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessInput(ctx context.Context, v any) (types.RevokeTrustCenterAccessInput, error) {
|
||||
res, err := ec.unmarshalInputRevokeTrustCenterAccessInput(ctx, v)
|
||||
return res, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNRevokeTrustCenterAccessPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v types.RevokeTrustCenterAccessPayload) graphql.Marshaler {
|
||||
return ec._RevokeTrustCenterAccessPayload(ctx, sel, &v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNRevokeTrustCenterAccessPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRevokeTrustCenterAccessPayload(ctx context.Context, sel ast.SelectionSet, v *types.RevokeTrustCenterAccessPayload) 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._RevokeTrustCenterAccessPayload(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNRisk2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRisk(ctx context.Context, sel ast.SelectionSet, v *types.Risk) graphql.Marshaler {
|
||||
if v == nil {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
@@ -61898,25 +61269,6 @@ 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)
|
||||
|
||||
@@ -26,7 +26,6 @@ func NewTrustCenterAccess(tca *coredata.TrustCenterAccess) *TrustCenterAccess {
|
||||
ID: tca.ID,
|
||||
Email: tca.Email,
|
||||
Name: tca.Name,
|
||||
Active: tca.Active,
|
||||
CreatedAt: tca.CreatedAt,
|
||||
UpdatedAt: tca.UpdatedAt,
|
||||
}
|
||||
|
||||
@@ -371,7 +371,6 @@ type CreateTrustCenterAccessInput struct {
|
||||
TrustCenterID gid.GID `json:"trustCenterId"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
SendEmail bool `json:"sendEmail"`
|
||||
}
|
||||
|
||||
type CreateTrustCenterAccessPayload struct {
|
||||
@@ -948,14 +947,6 @@ type RequestSignaturePayload struct {
|
||||
DocumentVersionSignatureEdge *DocumentVersionSignatureEdge `json:"documentVersionSignatureEdge"`
|
||||
}
|
||||
|
||||
type RevokeTrustCenterAccessInput struct {
|
||||
AccessID gid.GID `json:"accessId"`
|
||||
}
|
||||
|
||||
type RevokeTrustCenterAccessPayload struct {
|
||||
TrustCenterAccess *TrustCenterAccess `json:"trustCenterAccess"`
|
||||
}
|
||||
|
||||
type Risk struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
@@ -1043,7 +1034,6 @@ 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"`
|
||||
}
|
||||
@@ -1236,18 +1226,6 @@ type UpdateTaskPayload struct {
|
||||
Task *Task `json:"task"`
|
||||
}
|
||||
|
||||
type UpdateTrustCenterAccessInput struct {
|
||||
AccessID gid.GID `json:"accessId"`
|
||||
Email *string `json:"email,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Active *bool `json:"active,omitempty"`
|
||||
SendEmail bool `json:"sendEmail"`
|
||||
}
|
||||
|
||||
type UpdateTrustCenterAccessPayload struct {
|
||||
TrustCenterAccess *TrustCenterAccess `json:"trustCenterAccess"`
|
||||
}
|
||||
|
||||
type UpdateTrustCenterInput struct {
|
||||
TrustCenterID gid.GID `json:"trustCenterId"`
|
||||
Active *bool `json:"active,omitempty"`
|
||||
|
||||
@@ -998,22 +998,6 @@ func (r *mutationResolver) UpdateTrustCenter(ctx context.Context, input types.Up
|
||||
}, nil
|
||||
}
|
||||
|
||||
// RevokeTrustCenterAccess is the resolver for the revokeTrustCenterAccess field.
|
||||
func (r *mutationResolver) RevokeTrustCenterAccess(ctx context.Context, input types.RevokeTrustCenterAccessInput) (*types.RevokeTrustCenterAccessPayload, error) {
|
||||
prb := r.ProboService(ctx, input.AccessID.TenantID())
|
||||
|
||||
access, err := prb.TrustCenterAccesses.RevokeAccess(ctx, &probo.RevokeTrustCenterAccessRequest{
|
||||
AccessID: input.AccessID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot revoke trust center access: %w", err)
|
||||
}
|
||||
|
||||
return &types.RevokeTrustCenterAccessPayload{
|
||||
TrustCenterAccess: types.NewTrustCenterAccess(access),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateTrustCenterAccess is the resolver for the createTrustCenterAccess field.
|
||||
func (r *mutationResolver) CreateTrustCenterAccess(ctx context.Context, input types.CreateTrustCenterAccessInput) (*types.CreateTrustCenterAccessPayload, error) {
|
||||
prb := r.ProboService(ctx, input.TrustCenterID.TenantID())
|
||||
@@ -1022,7 +1006,6 @@ func (r *mutationResolver) CreateTrustCenterAccess(ctx context.Context, input ty
|
||||
TrustCenterID: input.TrustCenterID,
|
||||
Email: input.Email,
|
||||
Name: input.Name,
|
||||
SendEmail: input.SendEmail,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot create trust center access: %w", err)
|
||||
@@ -1033,26 +1016,6 @@ 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.AccessID.TenantID())
|
||||
|
||||
access, err := prb.TrustCenterAccesses.Update(ctx, &probo.UpdateTrustCenterAccessRequest{
|
||||
AccessID: input.AccessID,
|
||||
Email: input.Email,
|
||||
Name: input.Name,
|
||||
Active: input.Active,
|
||||
SendEmail: input.SendEmail,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, 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())
|
||||
|
||||
@@ -239,13 +239,6 @@ func tryTokenAuth(ctx context.Context, w http.ResponseWriter, r *http.Request, t
|
||||
}
|
||||
|
||||
tenantID := payload.Data.TrustCenterID.TenantID()
|
||||
tenantSvc := trustSvc.WithTenant(tenantID)
|
||||
isActive, err := tenantSvc.TrustCenterAccesses.IsAccessActive(ctx, payload.Data.TrustCenterID, payload.Data.Email)
|
||||
|
||||
if err != nil || !isActive {
|
||||
clearTokenCookie(w, authCfg)
|
||||
return nil
|
||||
}
|
||||
|
||||
tokenAccess := &auth.TokenAccessData{
|
||||
TrustCenterID: payload.Data.TrustCenterID,
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/getprobo/probo/pkg/coredata"
|
||||
"github.com/getprobo/probo/pkg/gid"
|
||||
"github.com/getprobo/probo/pkg/probo"
|
||||
"github.com/getprobo/probo/pkg/statelesstoken"
|
||||
"github.com/getprobo/probo/pkg/usrmgr"
|
||||
@@ -64,26 +63,5 @@ func (s TrustCenterAccessService) ValidateToken(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !access.Active {
|
||||
return nil, fmt.Errorf("access has been revoked")
|
||||
}
|
||||
|
||||
return &token.Data, nil
|
||||
}
|
||||
|
||||
func (s TrustCenterAccessService) IsAccessActive(
|
||||
ctx context.Context,
|
||||
trustCenterID gid.GID,
|
||||
email string,
|
||||
) (bool, error) {
|
||||
access := &coredata.TrustCenterAccess{}
|
||||
err := s.svc.pg.WithConn(ctx, func(conn pg.Conn) error {
|
||||
return access.LoadByTrustCenterIDAndEmail(ctx, conn, s.svc.scope, trustCenterID, email)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("cannot load trust center access: %w", err)
|
||||
}
|
||||
|
||||
return access.Active, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user