Fix trust center access tab permissions handling
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<5b13ffbac04cd7b7bdfa68d47f6ad6ee>>
|
* @generated SignedSource<<7a9c0c1a8292affc2ed9584fca098c64>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -26,6 +26,8 @@ export type TrustCenterAccessGraphCreateMutation$data = {
|
|||||||
readonly node: {
|
readonly node: {
|
||||||
readonly active: boolean;
|
readonly active: boolean;
|
||||||
readonly activeCount: number;
|
readonly activeCount: number;
|
||||||
|
readonly canDelete: boolean;
|
||||||
|
readonly canUpdate: boolean;
|
||||||
readonly createdAt: string;
|
readonly createdAt: string;
|
||||||
readonly email: string;
|
readonly email: string;
|
||||||
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
||||||
@@ -145,6 +147,32 @@ v3 = {
|
|||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "activeCount",
|
"name": "activeCount",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-access:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-access:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-access:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-access:delete\")"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
@@ -218,16 +246,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "501c3c38f8d44e41a178514443803ce2",
|
"cacheID": "b080e2a38e706bea45f06507675582a4",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterAccessGraphCreateMutation",
|
"name": "TrustCenterAccessGraphCreateMutation",
|
||||||
"operationKind": "mutation",
|
"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 hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\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 active\n hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n }\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "bfe1841f269ba04a77e9b3ecf73665d2";
|
(node as any).hash = "c33af388ca0957f16ee36e06339d61d3";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<ee0e02d6ca32ed5047c1aa0040c6f74e>>
|
* @generated SignedSource<<103e4c33c37a708bdc24fe74767725b9>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -257,6 +257,32 @@ return {
|
|||||||
"name": "activeCount",
|
"name": "activeCount",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-access:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-access:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-access:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-access:delete\")"
|
||||||
|
},
|
||||||
(v2/*: any*/)
|
(v2/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
@@ -300,16 +326,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "98a87a363a8a26e30506346db052e11a",
|
"cacheID": "6b9515ca548d21d6ba53ac5d830010f5",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterAccessGraphPaginationQuery",
|
"name": "TrustCenterAccessGraphPaginationQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query TrustCenterAccessGraphPaginationQuery(\n $count: Int\n $cursor: CursorKey\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TrustCenterAccessGraph_accesses\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, 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 hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n __typename\n }\n }\n }\n id\n}\n"
|
"text": "query TrustCenterAccessGraphPaginationQuery(\n $count: Int\n $cursor: CursorKey\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TrustCenterAccessGraph_accesses\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, 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 hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "10bb084980182a1e2334be77c29cf1ec";
|
(node as any).hash = "41517deef6af7eec916f3a4bbfc217b7";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<4b12d9aad859607c861537fbdf5ea292>>
|
* @generated SignedSource<<4f1a16e8b28a887285c9bc578e201f75>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -272,6 +272,32 @@ return {
|
|||||||
"name": "activeCount",
|
"name": "activeCount",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-access:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-access:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-access:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-access:delete\")"
|
||||||
|
},
|
||||||
(v5/*: any*/)
|
(v5/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
@@ -315,12 +341,12 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "703f94692a1696b15e0c92b282866673",
|
"cacheID": "a8ee8e139d510095436df64e84d7a5ba",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterAccessGraphQuery",
|
"name": "TrustCenterAccessGraphQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query TrustCenterAccessGraphQuery(\n $trustCenterId: ID!\n $count: Int!\n $cursor: CursorKey\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n ...TrustCenterAccessGraph_accesses\n }\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, 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 hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n __typename\n }\n }\n }\n id\n}\n"
|
"text": "query TrustCenterAccessGraphQuery(\n $trustCenterId: ID!\n $count: Int!\n $cursor: CursorKey\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n ...TrustCenterAccessGraph_accesses\n }\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, 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 hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<f93ee7f1b0f384bafe3a11df6a514c0c>>
|
* @generated SignedSource<<6cbc57ab24be22cdb76257d73f3a47d5>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -18,6 +18,8 @@ export type TrustCenterAccessGraph_accesses$data = {
|
|||||||
readonly node: {
|
readonly node: {
|
||||||
readonly active: boolean;
|
readonly active: boolean;
|
||||||
readonly activeCount: number;
|
readonly activeCount: number;
|
||||||
|
readonly canDelete: boolean;
|
||||||
|
readonly canUpdate: boolean;
|
||||||
readonly createdAt: string;
|
readonly createdAt: string;
|
||||||
readonly email: string;
|
readonly email: string;
|
||||||
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
||||||
@@ -233,6 +235,32 @@ return {
|
|||||||
"name": "activeCount",
|
"name": "activeCount",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-access:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-access:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-access:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-access:delete\")"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -268,6 +296,6 @@ return {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "10bb084980182a1e2334be77c29cf1ec";
|
(node as any).hash = "41517deef6af7eec916f3a4bbfc217b7";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<a519c4a7c9b9c46e3f4b29a0025d1251>>
|
* @generated SignedSource<<c72040bdfe1bee8cd0816c07975227d7>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -51,6 +51,7 @@ export type TrustCenterGraphQuery$data = {
|
|||||||
};
|
};
|
||||||
readonly trustCenter?: {
|
readonly trustCenter?: {
|
||||||
readonly active: boolean;
|
readonly active: boolean;
|
||||||
|
readonly canCreateAccess: boolean;
|
||||||
readonly canCreateReference: boolean;
|
readonly canCreateReference: boolean;
|
||||||
readonly canDeleteNDA: boolean;
|
readonly canDeleteNDA: boolean;
|
||||||
readonly canGetNDA: boolean;
|
readonly canGetNDA: boolean;
|
||||||
@@ -257,6 +258,19 @@ v8 = {
|
|||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "permission",
|
"name": "permission",
|
||||||
"storageKey": "permission(action:\"core:trust-center-reference:create\")"
|
"storageKey": "permission(action:\"core:trust-center-reference:create\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canCreateAccess",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-access:create"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-access:create\")"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
@@ -929,7 +943,7 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "0e95539cb6609d5698a7311262b81a99",
|
"cacheID": "e04f245ca84bd7221a3e0187b8e988a5",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"connection": [
|
"connection": [
|
||||||
@@ -946,11 +960,11 @@ return {
|
|||||||
},
|
},
|
||||||
"name": "TrustCenterGraphQuery",
|
"name": "TrustCenterGraphQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n canCreateTrustCenterFile: permission(action: \"core:trust-center-file:create\")\n customDomain {\n id\n domain\n }\n trustCenter {\n id\n active\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center:update\")\n canGetNDA: permission(action: \"core:trust-center:get-nda\")\n canUploadNDA: permission(action: \"core:trust-center:upload-nda\")\n canDeleteNDA: permission(action: \"core:trust-center:delete-nda\")\n canCreateReference: permission(action: \"core:trust-center-reference:create\")\n }\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n audits(first: 100) {\n edges {\n node {\n id\n ...TrustCenterAuditsCardFragment\n }\n }\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n trustCenterFiles(first: 100) {\n edges {\n node {\n id\n ...TrustCenterFilesCardFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n slackConnections(first: 100) {\n edges {\n node {\n id\n channel\n channelId\n createdAt\n updatedAt\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n trustCenterVisibility\n createdAt\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n trustCenterVisibility\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n\nfragment TrustCenterFilesCardFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n canUpdate: permission(action: \"core:vendor:update\")\n}\n"
|
"text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n canCreateTrustCenterFile: permission(action: \"core:trust-center-file:create\")\n customDomain {\n id\n domain\n }\n trustCenter {\n id\n active\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center:update\")\n canGetNDA: permission(action: \"core:trust-center:get-nda\")\n canUploadNDA: permission(action: \"core:trust-center:upload-nda\")\n canDeleteNDA: permission(action: \"core:trust-center:delete-nda\")\n canCreateReference: permission(action: \"core:trust-center-reference:create\")\n canCreateAccess: permission(action: \"core:trust-center-access:create\")\n }\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n audits(first: 100) {\n edges {\n node {\n id\n ...TrustCenterAuditsCardFragment\n }\n }\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n trustCenterFiles(first: 100) {\n edges {\n node {\n id\n ...TrustCenterFilesCardFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n slackConnections(first: 100) {\n edges {\n node {\n id\n channel\n channelId\n createdAt\n updatedAt\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n trustCenterVisibility\n createdAt\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n trustCenterVisibility\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n\nfragment TrustCenterFilesCardFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n canUpdate: permission(action: \"core:vendor:update\")\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "9669200b7f9e58c412b73b30fa506f51";
|
(node as any).hash = "c2590192391f38eab216d98c0c536118";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ export const trustCenterAccessesPaginationFragment = graphql`
|
|||||||
lastTokenExpiresAt
|
lastTokenExpiresAt
|
||||||
pendingRequestCount
|
pendingRequestCount
|
||||||
activeCount
|
activeCount
|
||||||
|
canUpdate: permission(action: "core:trust-center-access:update")
|
||||||
|
canDelete: permission(action: "core:trust-center-access:delete")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,6 +74,8 @@ export const createTrustCenterAccessMutation = graphql`
|
|||||||
lastTokenExpiresAt
|
lastTokenExpiresAt
|
||||||
pendingRequestCount
|
pendingRequestCount
|
||||||
activeCount
|
activeCount
|
||||||
|
canUpdate: permission(action: "core:trust-center-access:update")
|
||||||
|
canDelete: permission(action: "core:trust-center-access:delete")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export const trustCenterQuery = graphql`
|
|||||||
canCreateReference: permission(
|
canCreateReference: permission(
|
||||||
action: "core:trust-center-reference:create"
|
action: "core:trust-center-reference:create"
|
||||||
)
|
)
|
||||||
|
canCreateAccess: permission(action: "core:trust-center-access:create")
|
||||||
}
|
}
|
||||||
documents(first: 100) {
|
documents(first: 100) {
|
||||||
edges {
|
edges {
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import type {
|
import type { TrustCenterDocumentAccessStatus } from "@probo/coredata";
|
||||||
TrustCenterAccess,
|
|
||||||
TrustCenterDocumentAccessStatus,
|
|
||||||
} from "@probo/coredata";
|
|
||||||
import {
|
import {
|
||||||
getTrustCenterDocumentAccessInfo,
|
getTrustCenterDocumentAccessInfo,
|
||||||
type TrustCenterDocumentAccessInfo,
|
type TrustCenterDocumentAccessInfo,
|
||||||
@@ -31,9 +28,11 @@ import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
|||||||
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
||||||
import { Suspense, useCallback, useEffect, useState } from "react";
|
import { Suspense, useCallback, useEffect, useState } from "react";
|
||||||
import { TrustCenterDocumentAccessList } from "./TrustCenterDocumentAccessList";
|
import { TrustCenterDocumentAccessList } from "./TrustCenterDocumentAccessList";
|
||||||
|
import type { TrustCenterAccessGraph_accesses$data } from "/__generated__/core/TrustCenterAccessGraph_accesses.graphql";
|
||||||
|
import type { NodeOf } from "/types";
|
||||||
|
|
||||||
interface TrustCenterAccessEditDialogProps {
|
interface TrustCenterAccessEditDialogProps {
|
||||||
access: TrustCenterAccess;
|
access: NodeOf<TrustCenterAccessGraph_accesses$data["accesses"]>;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ export function TrustCenterAccessEditDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface TrustCenterAccessEditFormProps {
|
interface TrustCenterAccessEditFormProps {
|
||||||
access: TrustCenterAccess;
|
access: NodeOf<TrustCenterAccessGraph_accesses$data["accesses"]>;
|
||||||
onSubmit: () => void;
|
onSubmit: () => void;
|
||||||
queryRef: PreloadedQuery<TrustCenterAccessGraphLoadDocumentAccessesQuery>;
|
queryRef: PreloadedQuery<TrustCenterAccessGraphLoadDocumentAccessesQuery>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +1,71 @@
|
|||||||
import type { TrustCenterAccess } from "@probo/coredata";
|
import {
|
||||||
import { Button, IconCheckmark1, IconCrossLargeX, IconPencil, IconTrashCan, Td, Tr } from "@probo/ui";
|
Button,
|
||||||
|
IconCheckmark1,
|
||||||
|
IconCrossLargeX,
|
||||||
|
IconPencil,
|
||||||
|
IconTrashCan,
|
||||||
|
Td,
|
||||||
|
Tr,
|
||||||
|
} from "@probo/ui";
|
||||||
import { formatDate } from "@probo/helpers";
|
import { formatDate } from "@probo/helpers";
|
||||||
import { use, useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
|
||||||
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
||||||
import { deleteTrustCenterAccessMutation } from "/hooks/graph/TrustCenterAccessGraph";
|
import { deleteTrustCenterAccessMutation } from "/hooks/graph/TrustCenterAccessGraph";
|
||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import { TrustCenterAccessEditDialog } from "./TrustCenterAccessEditDialog";
|
import { TrustCenterAccessEditDialog } from "./TrustCenterAccessEditDialog";
|
||||||
|
import type { TrustCenterAccessGraph_accesses$data } from "/__generated__/core/TrustCenterAccessGraph_accesses.graphql";
|
||||||
|
import type { NodeOf } from "/types";
|
||||||
|
|
||||||
interface TrustCenterAccessItemProps {
|
interface TrustCenterAccessItemProps {
|
||||||
access: TrustCenterAccess
|
access: NodeOf<TrustCenterAccessGraph_accesses$data["accesses"]>;
|
||||||
connectionId?: string;
|
connectionId?: string;
|
||||||
dialogOpen: boolean,
|
dialogOpen: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TrustCenterAccessItem(props: TrustCenterAccessItemProps) {
|
export function TrustCenterAccessItem(props: TrustCenterAccessItemProps) {
|
||||||
const { access, connectionId, dialogOpen: initialDialogOpen } = props;
|
const { access, connectionId, dialogOpen: initialDialogOpen } = props;
|
||||||
|
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const { isAuthorized } = use(PermissionsContext);
|
const [dialogOpen, setDialogOpen] = useState<boolean>(initialDialogOpen);
|
||||||
const [dialogOpen, setDialogOpen] = useState<boolean>(initialDialogOpen)
|
|
||||||
|
|
||||||
const [deleteInvitation, isDeleting] = useMutationWithToasts(deleteTrustCenterAccessMutation, {
|
const [deleteInvitation, isDeleting] = useMutationWithToasts(
|
||||||
|
deleteTrustCenterAccessMutation,
|
||||||
|
{
|
||||||
successMessage: __("Access deleted successfully"),
|
successMessage: __("Access deleted successfully"),
|
||||||
errorMessage: __("Failed to delete access"),
|
errorMessage: __("Failed to delete access"),
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const handleDelete = useCallback(async (id: string) => {
|
const handleDelete = useCallback(
|
||||||
|
async (id: string) => {
|
||||||
await deleteInvitation({
|
await deleteInvitation({
|
||||||
variables: {
|
variables: {
|
||||||
input: { id },
|
input: { id },
|
||||||
connections: connectionId ? [connectionId] : [],
|
connections: connectionId ? [connectionId] : [],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [deleteInvitation, connectionId]);
|
},
|
||||||
|
[deleteInvitation, connectionId],
|
||||||
|
);
|
||||||
|
|
||||||
const isExpired = access.lastTokenExpiresAt ? new Date(access.lastTokenExpiresAt) < new Date() : false;
|
const isExpired = access.lastTokenExpiresAt
|
||||||
|
? new Date(access.lastTokenExpiresAt) < new Date()
|
||||||
|
: false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tr
|
<Tr
|
||||||
key={access.id}
|
key={access.id}
|
||||||
onClick={() => setDialogOpen(true)}
|
onClick={() => access.canUpdate && setDialogOpen(true)}
|
||||||
className="cursor-pointer hover:bg-bg-secondary transition-colors"
|
className="cursor-pointer hover:bg-bg-secondary transition-colors"
|
||||||
>
|
>
|
||||||
<Td className="font-medium">{access.name}</Td>
|
<Td className="font-medium">{access.name}</Td>
|
||||||
<Td>{access.email}</Td>
|
<Td>{access.email}</Td>
|
||||||
<Td>
|
<Td>{formatDate(access.createdAt)}</Td>
|
||||||
{formatDate(access.createdAt)}
|
|
||||||
</Td>
|
|
||||||
<Td className={isExpired ? "text-txt-danger" : ""}>
|
<Td className={isExpired ? "text-txt-danger" : ""}>
|
||||||
{access.lastTokenExpiresAt ? formatDate(access.lastTokenExpiresAt) : "-"}
|
{access.lastTokenExpiresAt
|
||||||
|
? formatDate(access.lastTokenExpiresAt)
|
||||||
|
: "-"}
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td>
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
@@ -61,9 +76,7 @@ export function TrustCenterAccessItem(props: TrustCenterAccessItemProps) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Td>
|
</Td>
|
||||||
<Td className="text-center">
|
<Td className="text-center">{access.activeCount}</Td>
|
||||||
{access.activeCount}
|
|
||||||
</Td>
|
|
||||||
<Td className="text-center">
|
<Td className="text-center">
|
||||||
{access.pendingRequestCount > 0 ? access.pendingRequestCount : ""}
|
{access.pendingRequestCount > 0 ? access.pendingRequestCount : ""}
|
||||||
</Td>
|
</Td>
|
||||||
@@ -79,14 +92,14 @@ export function TrustCenterAccessItem(props: TrustCenterAccessItemProps) {
|
|||||||
className="flex gap-2 justify-end"
|
className="flex gap-2 justify-end"
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
{isAuthorized("TrustCenterAccess", "updateTrustCenterAccess") && (
|
{access.canUpdate && (
|
||||||
<Button
|
<Button
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onClick={() => setDialogOpen(true)}
|
onClick={() => setDialogOpen(true)}
|
||||||
icon={IconPencil}
|
icon={IconPencil}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isAuthorized("TrustCenterAccess", "deleteTrustCenterAccess") && (
|
{access.canDelete && (
|
||||||
<Button
|
<Button
|
||||||
variant="danger"
|
variant="danger"
|
||||||
onClick={() => handleDelete(access.id)}
|
onClick={() => handleDelete(access.id)}
|
||||||
@@ -98,7 +111,12 @@ export function TrustCenterAccessItem(props: TrustCenterAccessItemProps) {
|
|||||||
</Td>
|
</Td>
|
||||||
</Tr>
|
</Tr>
|
||||||
|
|
||||||
{dialogOpen && <TrustCenterAccessEditDialog access={access} onClose={() => setDialogOpen(false)} />}
|
{access.canUpdate && dialogOpen && (
|
||||||
|
<TrustCenterAccessEditDialog
|
||||||
|
access={access}
|
||||||
|
onClose={() => setDialogOpen(false)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
} from "@probo/ui";
|
} from "@probo/ui";
|
||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import { useOutletContext } from "react-router";
|
import { useOutletContext } from "react-router";
|
||||||
import { useState, useEffect, use, useMemo } from "react";
|
import { useState, useEffect, useMemo } from "react";
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
import {
|
import {
|
||||||
useTrustCenterAccesses,
|
useTrustCenterAccesses,
|
||||||
@@ -25,77 +25,53 @@ import {
|
|||||||
} from "/hooks/graph/TrustCenterAccessGraph";
|
} from "/hooks/graph/TrustCenterAccessGraph";
|
||||||
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
||||||
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
||||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
|
||||||
import { TrustCenterAccessItem } from "./TrustCenterAccessItem";
|
import { TrustCenterAccessItem } from "./TrustCenterAccessItem";
|
||||||
import type { TrustCenterAccess } from "@probo/coredata";
|
import type { TrustCenterGraphQuery$data } from "/__generated__/core/TrustCenterGraphQuery.graphql";
|
||||||
|
import type { NodeOf } from "/types";
|
||||||
type ContextType = {
|
import type { TrustCenterAccessGraph_accesses$data } from "/__generated__/core/TrustCenterAccessGraph_accesses.graphql";
|
||||||
organization: {
|
|
||||||
id: string;
|
|
||||||
trustCenter?: {
|
|
||||||
id: string;
|
|
||||||
};
|
|
||||||
documents?: {
|
|
||||||
edges: Array<{
|
|
||||||
node: {
|
|
||||||
id: string;
|
|
||||||
title: string;
|
|
||||||
documentType: string;
|
|
||||||
trustCenterVisibility: string;
|
|
||||||
};
|
|
||||||
}>;
|
|
||||||
};
|
|
||||||
audits?: {
|
|
||||||
edges: Array<{
|
|
||||||
node: {
|
|
||||||
id: string;
|
|
||||||
filename: string;
|
|
||||||
trustCenterVisibility: string;
|
|
||||||
framework: {
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}>;
|
|
||||||
};
|
|
||||||
trustCenterFiles?: {
|
|
||||||
edges: Array<{
|
|
||||||
node: {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
category: string;
|
|
||||||
trustCenterVisibility: string;
|
|
||||||
};
|
|
||||||
}>;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function TrustCenterAccessTab() {
|
export default function TrustCenterAccessTab() {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const { organization } = useOutletContext<ContextType>();
|
const { organization } = useOutletContext<TrustCenterGraphQuery$data>();
|
||||||
const { isAuthorized } = use(PermissionsContext);
|
|
||||||
const inviteSchema = z.object({
|
const inviteSchema = z.object({
|
||||||
name: z.string().min(1, __("Name is required")).min(2, __("Name must be at least 2 characters long")),
|
name: z
|
||||||
email: z.string().min(1, __("Email is required")).email(__("Please enter a valid email address")),
|
.string()
|
||||||
|
.min(1, __("Name is required"))
|
||||||
|
.min(2, __("Name must be at least 2 characters long")),
|
||||||
|
email: z
|
||||||
|
.string()
|
||||||
|
.min(1, __("Email is required"))
|
||||||
|
.email(__("Please enter a valid email address")),
|
||||||
});
|
});
|
||||||
|
|
||||||
const [createInvitation, isCreating] = useMutationWithToasts(createTrustCenterAccessMutation, {
|
const [createInvitation, isCreating] = useMutationWithToasts(
|
||||||
|
createTrustCenterAccessMutation,
|
||||||
|
{
|
||||||
successMessage: __("Access created successfully"),
|
successMessage: __("Access created successfully"),
|
||||||
errorMessage: __("Failed to create access"),
|
errorMessage: __("Failed to create access"),
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const dialogRef = useDialogRef();
|
const dialogRef = useDialogRef();
|
||||||
const [editingAccess, setEditingAccess] = useState<TrustCenterAccess | null>(null);
|
const [editingAccess, setEditingAccess] = useState<NodeOf<
|
||||||
|
TrustCenterAccessGraph_accesses$data["accesses"]
|
||||||
|
> | null>(null);
|
||||||
const [pendingEditEmail, setPendingEditEmail] = useState<string | null>(null);
|
const [pendingEditEmail, setPendingEditEmail] = useState<string | null>(null);
|
||||||
|
|
||||||
const inviteForm = useFormWithSchema(inviteSchema, {
|
const inviteForm = useFormWithSchema(inviteSchema, {
|
||||||
defaultValues: { name: "", email: "" },
|
defaultValues: { name: "", email: "" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data: trustCenterData, loadMore, hasNext, isLoadingNext } = useTrustCenterAccesses(organization.trustCenter?.id || "");
|
const {
|
||||||
|
data: trustCenterData,
|
||||||
|
loadMore,
|
||||||
|
hasNext,
|
||||||
|
isLoadingNext,
|
||||||
|
} = useTrustCenterAccesses(organization.trustCenter?.id || "");
|
||||||
|
|
||||||
const accesses: TrustCenterAccess[] = useMemo(
|
const accesses = useMemo(
|
||||||
() => trustCenterData?.accesses?.edges.map((edge) => edge.node) ?? [], [trustCenterData?.accesses?.edges]
|
() => trustCenterData?.accesses?.edges.map((edge) => edge.node) ?? [],
|
||||||
|
[trustCenterData?.accesses?.edges],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleInvite = inviteForm.handleSubmit(async (data) => {
|
const handleInvite = inviteForm.handleSubmit(async (data) => {
|
||||||
@@ -124,7 +100,9 @@ export default function TrustCenterAccessTab() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (pendingEditEmail && accesses.length > 0) {
|
if (pendingEditEmail && accesses.length > 0) {
|
||||||
const newAccess = accesses.find(access => access.email === pendingEditEmail);
|
const newAccess = accesses.find(
|
||||||
|
(access) => access.email === pendingEditEmail,
|
||||||
|
);
|
||||||
if (newAccess) {
|
if (newAccess) {
|
||||||
setPendingEditEmail(null);
|
setPendingEditEmail(null);
|
||||||
setEditingAccess(newAccess);
|
setEditingAccess(newAccess);
|
||||||
@@ -144,18 +122,22 @@ export default function TrustCenterAccessTab() {
|
|||||||
<div>
|
<div>
|
||||||
<h3 className="text-base font-medium">{__("External Access")}</h3>
|
<h3 className="text-base font-medium">{__("External Access")}</h3>
|
||||||
<p className="text-sm text-txt-tertiary">
|
<p className="text-sm text-txt-tertiary">
|
||||||
{__("Manage who can access your trust center with time-limited tokens")}
|
{__(
|
||||||
|
"Manage who can access your trust center with time-limited tokens",
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{organization.trustCenter?.id && (
|
{organization.trustCenter?.id &&
|
||||||
isAuthorized("TrustCenter", "createTrustCenterAccess") && (
|
organization.trustCenter.canCreateAccess && (
|
||||||
<Button icon={IconPlusLarge} onClick={() => {
|
<Button
|
||||||
|
icon={IconPlusLarge}
|
||||||
|
onClick={() => {
|
||||||
inviteForm.reset();
|
inviteForm.reset();
|
||||||
dialogRef.current?.open();
|
dialogRef.current?.open();
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{__("Add Access")}
|
{__("Add Access")}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -221,15 +203,14 @@ export default function TrustCenterAccessTab() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Dialog
|
<Dialog ref={dialogRef} title={__("Invite External Access")}>
|
||||||
ref={dialogRef}
|
|
||||||
title={__("Invite External Access")}
|
|
||||||
>
|
|
||||||
<form onSubmit={handleInvite}>
|
<form onSubmit={handleInvite}>
|
||||||
<DialogContent padded className="space-y-6">
|
<DialogContent padded className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<p className="text-txt-secondary text-sm mb-4">
|
<p className="text-txt-secondary text-sm mb-4">
|
||||||
{__("Send a 30-day access token to an external person to view your trust center")}
|
{__(
|
||||||
|
"Send a 30-day access token to an external person to view your trust center",
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import type { TrustCenterDocumentAccess } from "./TrustCenterDocumentAccess";
|
|
||||||
|
|
||||||
export interface TrustCenterAccess {
|
|
||||||
id: string;
|
|
||||||
email: string;
|
|
||||||
name: string;
|
|
||||||
active: boolean;
|
|
||||||
hasAcceptedNonDisclosureAgreement: boolean;
|
|
||||||
createdAt: string;
|
|
||||||
lastTokenExpiresAt?: string | null;
|
|
||||||
pendingRequestCount: number;
|
|
||||||
activeCount: number;
|
|
||||||
documentAccesses?: TrustCenterDocumentAccess[];
|
|
||||||
}
|
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
export type { TrustCenterAccess } from "./TrustCenterAccess";
|
export type {
|
||||||
export type { TrustCenterDocumentAccess, TrustCenterDocumentAccessStatus } from "./TrustCenterDocumentAccess";
|
TrustCenterDocumentAccess,
|
||||||
|
TrustCenterDocumentAccessStatus,
|
||||||
|
} from "./TrustCenterDocumentAccess";
|
||||||
|
|||||||
Reference in New Issue
Block a user