diff --git a/apps/console/src/__generated__/core/MainLayoutQuery.graphql.ts b/apps/console/src/__generated__/core/MainLayoutQuery.graphql.ts deleted file mode 100644 index 6db37dbe4..000000000 --- a/apps/console/src/__generated__/core/MainLayoutQuery.graphql.ts +++ /dev/null @@ -1,161 +0,0 @@ -/** - * @generated SignedSource<> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest } from 'relay-runtime'; -export type MainLayoutQuery$variables = { - organizationId: string; -}; -export type MainLayoutQuery$data = { - readonly organization: { - readonly id?: string; - readonly logoUrl?: string | null | undefined; - readonly name?: string; - }; - readonly viewer: { - readonly id: string; - }; -}; -export type MainLayoutQuery = { - response: MainLayoutQuery$data; - variables: MainLayoutQuery$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "organizationId" - } -], -v1 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null -}, -v2 = { - "alias": null, - "args": null, - "concreteType": "Viewer", - "kind": "LinkedField", - "name": "viewer", - "plural": false, - "selections": [ - (v1/*: any*/) - ], - "storageKey": null -}, -v3 = [ - { - "kind": "Variable", - "name": "id", - "variableName": "organizationId" - } -], -v4 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null -}, -v5 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "logoUrl", - "storageKey": null -}; -return { - "fragment": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Fragment", - "metadata": null, - "name": "MainLayoutQuery", - "selections": [ - (v2/*: any*/), - { - "alias": "organization", - "args": (v3/*: any*/), - "concreteType": null, - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "kind": "InlineFragment", - "selections": [ - (v1/*: any*/), - (v4/*: any*/), - (v5/*: any*/) - ], - "type": "Organization", - "abstractKey": null - } - ], - "storageKey": null - } - ], - "type": "Query", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Operation", - "name": "MainLayoutQuery", - "selections": [ - (v2/*: any*/), - { - "alias": "organization", - "args": (v3/*: any*/), - "concreteType": null, - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - }, - (v1/*: any*/), - { - "kind": "InlineFragment", - "selections": [ - (v4/*: any*/), - (v5/*: any*/) - ], - "type": "Organization", - "abstractKey": null - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "2ec49ff40720bacec29e7b6b1bf1408b", - "id": null, - "metadata": {}, - "name": "MainLayoutQuery", - "operationKind": "query", - "text": "query MainLayoutQuery(\n $organizationId: ID!\n) {\n viewer {\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n logoUrl\n }\n id\n }\n}\n" - } -}; -})(); - -(node as any).hash = "d958a2acbd9d13698b9c2b350b05d5a0"; - -export default node; diff --git a/apps/console/src/__generated__/core/RightsRequestGraphListQuery.graphql.ts b/apps/console/src/__generated__/core/RightsRequestGraphListQuery.graphql.ts index 26cd91c1c..00fc61bab 100644 --- a/apps/console/src/__generated__/core/RightsRequestGraphListQuery.graphql.ts +++ b/apps/console/src/__generated__/core/RightsRequestGraphListQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<22e08aea59fb3427d7770d89a44d6e9e>> + * @generated SignedSource<<5eff506b761b5790caf4b18a51cf2a88>> * @lightSyntaxTransform * @nogrep */ @@ -15,6 +15,7 @@ export type RightsRequestGraphListQuery$variables = { }; export type RightsRequestGraphListQuery$data = { readonly node: { + readonly canCreateRightsRequest?: boolean; readonly " $fragmentSpreads": FragmentRefs<"RightsRequestsPageFragment">; }; }; @@ -39,20 +40,33 @@ v1 = [ } ], v2 = { + "alias": "canCreateRightsRequest", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:rights-request:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:rights-request:create\")" +}, +v3 = { "alias": null, "args": null, "kind": "ScalarField", "name": "__typename", "storageKey": null }, -v3 = { +v4 = { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, -v4 = [ +v5 = [ { "kind": "Literal", "name": "first", @@ -77,6 +91,7 @@ return { { "kind": "InlineFragment", "selections": [ + (v2/*: any*/), { "args": null, "kind": "FragmentSpread", @@ -107,14 +122,15 @@ return { "name": "node", "plural": false, "selections": [ - (v2/*: any*/), (v3/*: any*/), + (v4/*: any*/), { "kind": "InlineFragment", "selections": [ + (v2/*: any*/), { "alias": null, - "args": (v4/*: any*/), + "args": (v5/*: any*/), "concreteType": "RightsRequestConnection", "kind": "LinkedField", "name": "rightsRequests", @@ -143,7 +159,7 @@ return { "name": "node", "plural": false, "selections": [ - (v3/*: any*/), + (v4/*: any*/), { "alias": null, "args": null, @@ -207,7 +223,33 @@ return { "name": "updatedAt", "storageKey": null }, - (v2/*: any*/) + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:rights-request:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:rights-request:delete\")" + }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:rights-request:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:rights-request:update\")" + }, + (v3/*: any*/) ], "storageKey": null }, @@ -263,7 +305,7 @@ return { }, { "alias": null, - "args": (v4/*: any*/), + "args": (v5/*: any*/), "filters": null, "handle": "connection", "key": "RightsRequestsPage_rightsRequests", @@ -280,16 +322,16 @@ return { ] }, "params": { - "cacheID": "77f124136a2da2eb84fb134e5d10396b", + "cacheID": "6bc485c10a9531beeb67aa6ff28a7ddc", "id": null, "metadata": {}, "name": "RightsRequestGraphListQuery", "operationKind": "query", - "text": "query RightsRequestGraphListQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...RightsRequestsPageFragment\n }\n id\n }\n}\n\nfragment RightsRequestsPageFragment on Organization {\n id\n rightsRequests(first: 10) {\n totalCount\n edges {\n node {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n" + "text": "query RightsRequestGraphListQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateRightsRequest: permission(action: \"core:rights-request:create\")\n ...RightsRequestsPageFragment\n }\n id\n }\n}\n\nfragment RightsRequestsPageFragment on Organization {\n id\n rightsRequests(first: 10) {\n totalCount\n edges {\n node {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n createdAt\n updatedAt\n canDelete: permission(action: \"core:rights-request:delete\")\n canUpdate: permission(action: \"core:rights-request:update\")\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n" } }; })(); -(node as any).hash = "6ff83d9e0017a4fb245ad9f13106a439"; +(node as any).hash = "0ec5bfd82df0184daee8f615b55f9b5b"; export default node; diff --git a/apps/console/src/__generated__/core/RightsRequestGraphNodeQuery.graphql.ts b/apps/console/src/__generated__/core/RightsRequestGraphNodeQuery.graphql.ts index 27c58de7d..518b94bc4 100644 --- a/apps/console/src/__generated__/core/RightsRequestGraphNodeQuery.graphql.ts +++ b/apps/console/src/__generated__/core/RightsRequestGraphNodeQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<23949230cfdefa0c2a321d4fa38e3ace>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -17,6 +17,8 @@ export type RightsRequestGraphNodeQuery$variables = { export type RightsRequestGraphNodeQuery$data = { readonly node: { readonly actionTaken?: string | null | undefined; + readonly canDelete?: boolean; + readonly canUpdate?: boolean; readonly contact?: string | null | undefined; readonly createdAt?: string; readonly dataSubject?: string | null | undefined; @@ -109,6 +111,32 @@ v9 = { "storageKey": null }, v10 = { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:rights-request:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:rights-request:update\")" +}, +v11 = { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:rights-request:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:rights-request:delete\")" +}, +v12 = { "alias": null, "args": null, "concreteType": "Organization", @@ -127,14 +155,14 @@ v10 = { ], "storageKey": null }, -v11 = { +v13 = { "alias": null, "args": null, "kind": "ScalarField", "name": "createdAt", "storageKey": null }, -v12 = { +v14 = { "alias": null, "args": null, "kind": "ScalarField", @@ -169,7 +197,9 @@ return { (v9/*: any*/), (v10/*: any*/), (v11/*: any*/), - (v12/*: any*/) + (v12/*: any*/), + (v13/*: any*/), + (v14/*: any*/) ], "type": "RightsRequest", "abstractKey": null @@ -215,7 +245,9 @@ return { (v9/*: any*/), (v10/*: any*/), (v11/*: any*/), - (v12/*: any*/) + (v12/*: any*/), + (v13/*: any*/), + (v14/*: any*/) ], "type": "RightsRequest", "abstractKey": null @@ -226,16 +258,16 @@ return { ] }, "params": { - "cacheID": "93aa5fb44159c0ae2709c34f493bc69f", + "cacheID": "ee78ca5ffa5a944254f733bfefdfbfab", "id": null, "metadata": {}, "name": "RightsRequestGraphNodeQuery", "operationKind": "query", - "text": "query RightsRequestGraphNodeQuery(\n $rightsRequestId: ID!\n) {\n node(id: $rightsRequestId) {\n __typename\n ... on RightsRequest {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n organization {\n id\n name\n }\n createdAt\n updatedAt\n }\n id\n }\n}\n" + "text": "query RightsRequestGraphNodeQuery(\n $rightsRequestId: ID!\n) {\n node(id: $rightsRequestId) {\n __typename\n ... on RightsRequest {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n canUpdate: permission(action: \"core:rights-request:update\")\n canDelete: permission(action: \"core:rights-request:delete\")\n organization {\n id\n name\n }\n createdAt\n updatedAt\n }\n id\n }\n}\n" } }; })(); -(node as any).hash = "9f7d09c59f937a8de6cfbc0354b42d1b"; +(node as any).hash = "77cc11eb6270df9b753572cf3a14689d"; export default node; diff --git a/apps/console/src/__generated__/core/RightsRequestsPageFragment.graphql.ts b/apps/console/src/__generated__/core/RightsRequestsPageFragment.graphql.ts index 51e7ef64a..7992e232b 100644 --- a/apps/console/src/__generated__/core/RightsRequestsPageFragment.graphql.ts +++ b/apps/console/src/__generated__/core/RightsRequestsPageFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<10add82cf941c1776c712d87451b6da1>> + * @generated SignedSource<<109da5292cbd22b553279fefd5c41c03>> * @lightSyntaxTransform * @nogrep */ @@ -19,6 +19,8 @@ export type RightsRequestsPageFragment$data = { readonly edges: ReadonlyArray<{ readonly node: { readonly actionTaken: string | null | undefined; + readonly canDelete: boolean; + readonly canUpdate: boolean; readonly contact: string | null | undefined; readonly createdAt: string; readonly dataSubject: string | null | undefined; @@ -196,6 +198,32 @@ return { "name": "updatedAt", "storageKey": null }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:rights-request:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:rights-request:delete\")" + }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:rights-request:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:rights-request:update\")" + }, { "alias": null, "args": null, @@ -262,6 +290,6 @@ return { }; })(); -(node as any).hash = "3476c393dc97ae3d730ed5715922e987"; +(node as any).hash = "cfb8b464e37afac281c1722b9daf1783"; export default node; diff --git a/apps/console/src/__generated__/core/RightsRequestsPageRefetchQuery.graphql.ts b/apps/console/src/__generated__/core/RightsRequestsPageRefetchQuery.graphql.ts index 815569d91..c13995f79 100644 --- a/apps/console/src/__generated__/core/RightsRequestsPageRefetchQuery.graphql.ts +++ b/apps/console/src/__generated__/core/RightsRequestsPageRefetchQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<47e719a83abc9c6cb5f5e1140f70cf70>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -217,6 +217,32 @@ return { "name": "updatedAt", "storageKey": null }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:rights-request:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:rights-request:delete\")" + }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:rights-request:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:rights-request:update\")" + }, (v3/*: any*/) ], "storageKey": null @@ -290,16 +316,16 @@ return { ] }, "params": { - "cacheID": "10c7e9a6f7813d150e34282befd799ff", + "cacheID": "a63c4d960c8f375acceeedd2f1b9a188", "id": null, "metadata": {}, "name": "RightsRequestsPageRefetchQuery", "operationKind": "query", - "text": "query RightsRequestsPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...RightsRequestsPageFragment_2HEEH6\n id\n }\n}\n\nfragment RightsRequestsPageFragment_2HEEH6 on Organization {\n id\n rightsRequests(first: $first, after: $after) {\n totalCount\n edges {\n node {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n" + "text": "query RightsRequestsPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...RightsRequestsPageFragment_2HEEH6\n id\n }\n}\n\nfragment RightsRequestsPageFragment_2HEEH6 on Organization {\n id\n rightsRequests(first: $first, after: $after) {\n totalCount\n edges {\n node {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n createdAt\n updatedAt\n canDelete: permission(action: \"core:rights-request:delete\")\n canUpdate: permission(action: \"core:rights-request:update\")\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n" } }; })(); -(node as any).hash = "3476c393dc97ae3d730ed5715922e987"; +(node as any).hash = "cfb8b464e37afac281c1722b9daf1783"; export default node; diff --git a/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql.ts b/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql.ts index 996787bec..d9ff9cb7f 100644 --- a/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql.ts +++ b/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<306449631752d4277aa96b77601e2d8f>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -26,6 +26,8 @@ export type StateOfApplicabilityControlsTabFragment$data = { readonly sectionTitle: string; readonly stateOfApplicabilityId: string | null | undefined; }>; + readonly canCreateStateOfApplicabilityControlMapping: boolean; + readonly canDeleteStateOfApplicabilityControlMapping: boolean; readonly controlsInfo: { readonly totalCount: number; }; @@ -88,6 +90,32 @@ const node: ReaderFragment = { ], "storageKey": "controls(first:0)" }, + { + "alias": "canCreateStateOfApplicabilityControlMapping", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:control-mapping:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:control-mapping:create\")" + }, + { + "alias": "canDeleteStateOfApplicabilityControlMapping", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:control-mapping:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:control-mapping:delete\")" + }, { "alias": null, "args": null, @@ -195,6 +223,6 @@ const node: ReaderFragment = { "abstractKey": null }; -(node as any).hash = "e72695289b29d1a4b60e3f7c18ba1165"; +(node as any).hash = "70183a65cc3c55a9ffddb4c2824bf5a7"; export default node; diff --git a/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts b/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts index 0711162aa..74ce42302 100644 --- a/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts +++ b/apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<06d34888ed5b3e0d66f2159e1a916196>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -120,6 +120,32 @@ return { ], "storageKey": "controls(first:0)" }, + { + "alias": "canCreateStateOfApplicabilityControlMapping", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:control-mapping:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:control-mapping:create\")" + }, + { + "alias": "canDeleteStateOfApplicabilityControlMapping", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:control-mapping:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:control-mapping:delete\")" + }, { "alias": null, "args": null, @@ -232,16 +258,16 @@ return { ] }, "params": { - "cacheID": "50874b763d9f2cfc01d097ec9b68ec82", + "cacheID": "7faadf001782b3aae9b9af0ce5ffa7a5", "id": null, "metadata": {}, "name": "StateOfApplicabilityControlsTabRefetchQuery", "operationKind": "query", - "text": "query StateOfApplicabilityControlsTabRefetchQuery(\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...StateOfApplicabilityControlsTabFragment\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n controlsInfo: controls(first: 0) {\n totalCount\n }\n availableControls {\n controlId\n sectionTitle\n name\n frameworkId\n frameworkName\n organizationId\n stateOfApplicabilityId\n applicability\n justification\n bestPractice\n regulatory\n contractual\n riskAssessment\n }\n}\n" + "text": "query StateOfApplicabilityControlsTabRefetchQuery(\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...StateOfApplicabilityControlsTabFragment\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n controlsInfo: controls(first: 0) {\n totalCount\n }\n canCreateStateOfApplicabilityControlMapping: permission(action: \"core:state-of-applicability:control-mapping:create\")\n canDeleteStateOfApplicabilityControlMapping: permission(action: \"core:state-of-applicability:control-mapping:delete\")\n availableControls {\n controlId\n sectionTitle\n name\n frameworkId\n frameworkName\n organizationId\n stateOfApplicabilityId\n applicability\n justification\n bestPractice\n regulatory\n contractual\n riskAssessment\n }\n}\n" } }; })(); -(node as any).hash = "e72695289b29d1a4b60e3f7c18ba1165"; +(node as any).hash = "70183a65cc3c55a9ffddb4c2824bf5a7"; export default node; diff --git a/apps/console/src/__generated__/core/StateOfApplicabilityGraphNodeQuery.graphql.ts b/apps/console/src/__generated__/core/StateOfApplicabilityGraphNodeQuery.graphql.ts index b9bb7bb58..c6a5b2e4a 100644 --- a/apps/console/src/__generated__/core/StateOfApplicabilityGraphNodeQuery.graphql.ts +++ b/apps/console/src/__generated__/core/StateOfApplicabilityGraphNodeQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<74ef0d7b05d90eaaac07851cfb57409f>> * @lightSyntaxTransform * @nogrep */ @@ -15,6 +15,8 @@ export type StateOfApplicabilityGraphNodeQuery$variables = { }; export type StateOfApplicabilityGraphNodeQuery$data = { readonly node: { + readonly canDelete?: boolean; + readonly canUpdate?: boolean; readonly createdAt?: string; readonly id?: string; readonly name?: string; @@ -94,6 +96,32 @@ v7 = { "storageKey": null }, v8 = { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:update\")" +}, +v9 = { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:delete\")" +}, +v10 = { "alias": null, "args": null, "concreteType": "Organization", @@ -105,7 +133,7 @@ v8 = { ], "storageKey": null }, -v9 = { +v11 = { "alias": null, "args": null, "concreteType": "People", @@ -150,6 +178,8 @@ return { (v7/*: any*/), (v8/*: any*/), (v9/*: any*/), + (v10/*: any*/), + (v11/*: any*/), { "args": null, "kind": "FragmentSpread", @@ -198,6 +228,8 @@ return { (v7/*: any*/), (v8/*: any*/), (v9/*: any*/), + (v10/*: any*/), + (v11/*: any*/), { "alias": "controlsInfo", "args": [ @@ -222,6 +254,32 @@ return { ], "storageKey": "controls(first:0)" }, + { + "alias": "canCreateStateOfApplicabilityControlMapping", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:control-mapping:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:control-mapping:create\")" + }, + { + "alias": "canDeleteStateOfApplicabilityControlMapping", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:control-mapping:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:control-mapping:delete\")" + }, { "alias": null, "args": null, @@ -328,16 +386,16 @@ return { ] }, "params": { - "cacheID": "2c2c6535c53d2073bd41b39771d1afd9", + "cacheID": "dfdfadde088e82025aaa6c9c290f96b6", "id": null, "metadata": {}, "name": "StateOfApplicabilityGraphNodeQuery", "operationKind": "query", - "text": "query StateOfApplicabilityGraphNodeQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n organization {\n id\n }\n owner {\n id\n fullName\n }\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n controlsInfo: controls(first: 0) {\n totalCount\n }\n availableControls {\n controlId\n sectionTitle\n name\n frameworkId\n frameworkName\n organizationId\n stateOfApplicabilityId\n applicability\n justification\n bestPractice\n regulatory\n contractual\n riskAssessment\n }\n}\n" + "text": "query StateOfApplicabilityGraphNodeQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:state-of-applicability:update\")\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n organization {\n id\n }\n owner {\n id\n fullName\n }\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n controlsInfo: controls(first: 0) {\n totalCount\n }\n canCreateStateOfApplicabilityControlMapping: permission(action: \"core:state-of-applicability:control-mapping:create\")\n canDeleteStateOfApplicabilityControlMapping: permission(action: \"core:state-of-applicability:control-mapping:delete\")\n availableControls {\n controlId\n sectionTitle\n name\n frameworkId\n frameworkName\n organizationId\n stateOfApplicabilityId\n applicability\n justification\n bestPractice\n regulatory\n contractual\n riskAssessment\n }\n}\n" } }; })(); -(node as any).hash = "88e882f3c0f529cc7224eb19a91191cf"; +(node as any).hash = "1a1f3480b9c66597d146c48ed1b00bd1"; export default node; diff --git a/apps/console/src/__generated__/core/StateOfApplicabilityGraphPaginatedFragment.graphql.ts b/apps/console/src/__generated__/core/StateOfApplicabilityGraphPaginatedFragment.graphql.ts index 39431d93b..29aa27b41 100644 --- a/apps/console/src/__generated__/core/StateOfApplicabilityGraphPaginatedFragment.graphql.ts +++ b/apps/console/src/__generated__/core/StateOfApplicabilityGraphPaginatedFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<3472918fdff6205597f39a6310f2ee08>> * @lightSyntaxTransform * @nogrep */ @@ -16,6 +16,7 @@ export type StateOfApplicabilityGraphPaginatedFragment$data = { readonly __id: string; readonly edges: ReadonlyArray<{ readonly node: { + readonly canDelete: boolean; readonly controlsInfo: { readonly totalCount: number; }; @@ -191,6 +192,19 @@ return { "name": "updatedAt", "storageKey": null }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:delete\")" + }, { "alias": "controlsInfo", "args": [ @@ -296,6 +310,6 @@ return { }; })(); -(node as any).hash = "895fc79e61b95bf83997e3d5bcc7f367"; +(node as any).hash = "82cf2a5ce701c34a41f8166371dd75c3"; export default node; diff --git a/apps/console/src/__generated__/core/StateOfApplicabilityGraphPaginatedQuery.graphql.ts b/apps/console/src/__generated__/core/StateOfApplicabilityGraphPaginatedQuery.graphql.ts index 1ec1a4a58..580784546 100644 --- a/apps/console/src/__generated__/core/StateOfApplicabilityGraphPaginatedQuery.graphql.ts +++ b/apps/console/src/__generated__/core/StateOfApplicabilityGraphPaginatedQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<1c22107bf5691e7764aa30352d99631e>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -15,8 +15,14 @@ export type StateOfApplicabilityGraphPaginatedQuery$variables = { }; export type StateOfApplicabilityGraphPaginatedQuery$data = { readonly organization: { - readonly id?: string; + readonly __typename: "Organization"; + readonly canCreateStateOfApplicability: boolean; + readonly id: string; readonly " $fragmentSpreads": FragmentRefs<"StateOfApplicabilityGraphPaginatedFragment">; + } | { + // This will never be '%other', but we need some + // value in case none of the concrete values match. + readonly __typename: "%other"; }; }; export type StateOfApplicabilityGraphPaginatedQuery = { @@ -43,17 +49,30 @@ v2 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "id", + "name": "__typename", "storageKey": null }, v3 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "__typename", + "name": "id", "storageKey": null }, -v4 = [ +v4 = { + "alias": "canCreateStateOfApplicability", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:create\")" +}, +v5 = [ { "kind": "Literal", "name": "filter", @@ -90,10 +109,12 @@ return { "name": "node", "plural": false, "selections": [ + (v2/*: any*/), { "kind": "InlineFragment", "selections": [ - (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/), { "args": null, "kind": "FragmentSpread", @@ -124,14 +145,15 @@ return { "name": "node", "plural": false, "selections": [ - (v3/*: any*/), (v2/*: any*/), + (v3/*: any*/), { "kind": "InlineFragment", "selections": [ + (v4/*: any*/), { "alias": null, - "args": (v4/*: any*/), + "args": (v5/*: any*/), "concreteType": "StateOfApplicabilityConnection", "kind": "LinkedField", "name": "statesOfApplicability", @@ -153,7 +175,7 @@ return { "name": "node", "plural": false, "selections": [ - (v2/*: any*/), + (v3/*: any*/), { "alias": null, "args": null, @@ -189,6 +211,19 @@ return { "name": "updatedAt", "storageKey": null }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:delete\")" + }, { "alias": "controlsInfo", "args": [ @@ -213,7 +248,7 @@ return { ], "storageKey": "controls(first:0)" }, - (v3/*: any*/) + (v2/*: any*/) ], "storageKey": null }, @@ -283,7 +318,7 @@ return { }, { "alias": null, - "args": (v4/*: any*/), + "args": (v5/*: any*/), "filters": [ "orderBy", "filter" @@ -303,16 +338,16 @@ return { ] }, "params": { - "cacheID": "c5f5cb61622ba5e4309521002c23a530", + "cacheID": "3d53dfeb5366c889e790a88116dd3a4a", "id": null, "metadata": {}, "name": "StateOfApplicabilityGraphPaginatedQuery", "operationKind": "query", - "text": "query StateOfApplicabilityGraphPaginatedQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...StateOfApplicabilityGraphPaginatedFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityGraphPaginatedFragment on Organization {\n statesOfApplicability(first: 50, orderBy: {direction: DESC, field: CREATED_AT}, filter: {snapshotId: null}) {\n edges {\n node {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n controlsInfo: controls(first: 0) {\n totalCount\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" + "text": "query StateOfApplicabilityGraphPaginatedQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n canCreateStateOfApplicability: permission(action: \"core:state-of-applicability:create\")\n ...StateOfApplicabilityGraphPaginatedFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityGraphPaginatedFragment on Organization {\n statesOfApplicability(first: 50, orderBy: {direction: DESC, field: CREATED_AT}, filter: {snapshotId: null}) {\n edges {\n node {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n controlsInfo: controls(first: 0) {\n totalCount\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" } }; })(); -(node as any).hash = "e5eb3f251055f7dd34f7af30251226ca"; +(node as any).hash = "2182e7aea21c8eba8b2cfda1e614b6e5"; export default node; diff --git a/apps/console/src/__generated__/core/StateOfApplicabilityListQuery.graphql.ts b/apps/console/src/__generated__/core/StateOfApplicabilityListQuery.graphql.ts index f574013ae..f5331c7f7 100644 --- a/apps/console/src/__generated__/core/StateOfApplicabilityListQuery.graphql.ts +++ b/apps/console/src/__generated__/core/StateOfApplicabilityListQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<9026caada1e636b7db342b11e6d324c0>> + * @generated SignedSource<<8bdd74dfae1b656006a07b2f89fe525d>> * @lightSyntaxTransform * @nogrep */ @@ -270,6 +270,19 @@ return { "name": "updatedAt", "storageKey": null }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:state-of-applicability:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:state-of-applicability:delete\")" + }, { "alias": "controlsInfo", "args": [ @@ -384,16 +397,16 @@ return { ] }, "params": { - "cacheID": "d3227559321509a2a525848a0e26e20b", + "cacheID": "68d8b8bc491e464ea692b6d37952bcbf", "id": null, "metadata": {}, "name": "StateOfApplicabilityListQuery", "operationKind": "query", - "text": "query StateOfApplicabilityListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $filter: StateOfApplicabilityFilter = {snapshotId: null}\n $first: Int = 50\n $last: Int = null\n $order: StateOfApplicabilityOrder = {direction: DESC, field: CREATED_AT}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...StateOfApplicabilityGraphPaginatedFragment_4cFWzS\n id\n }\n}\n\nfragment StateOfApplicabilityGraphPaginatedFragment_4cFWzS on Organization {\n statesOfApplicability(first: $first, after: $after, last: $last, before: $before, orderBy: $order, filter: $filter) {\n edges {\n node {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n controlsInfo: controls(first: 0) {\n totalCount\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" + "text": "query StateOfApplicabilityListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $filter: StateOfApplicabilityFilter = {snapshotId: null}\n $first: Int = 50\n $last: Int = null\n $order: StateOfApplicabilityOrder = {direction: DESC, field: CREATED_AT}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...StateOfApplicabilityGraphPaginatedFragment_4cFWzS\n id\n }\n}\n\nfragment StateOfApplicabilityGraphPaginatedFragment_4cFWzS on Organization {\n statesOfApplicability(first: $first, after: $after, last: $last, before: $before, orderBy: $order, filter: $filter) {\n edges {\n node {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n controlsInfo: controls(first: 0) {\n totalCount\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" } }; })(); -(node as any).hash = "895fc79e61b95bf83997e3d5bcc7f367"; +(node as any).hash = "82cf2a5ce701c34a41f8166371dd75c3"; export default node; diff --git a/apps/console/src/__generated__/iam/MembershipLayoutQuery.graphql.ts b/apps/console/src/__generated__/iam/MembershipLayoutQuery.graphql.ts index 73a4a712a..e06615baa 100644 --- a/apps/console/src/__generated__/iam/MembershipLayoutQuery.graphql.ts +++ b/apps/console/src/__generated__/iam/MembershipLayoutQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<57b1d454985b710fd8d5ccecfa90f97d>> + * @generated SignedSource<<698ad015edeb94e58ec661b6118dca4b>> * @lightSyntaxTransform * @nogrep */ @@ -10,12 +10,21 @@ import { ConcreteRequest } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; +export type MembershipRole = "ADMIN" | "AUDITOR" | "EMPLOYEE" | "OWNER" | "VIEWER"; export type MembershipLayoutQuery$variables = { organizationId: string; }; export type MembershipLayoutQuery$data = { readonly organization: { + readonly __typename: "Organization"; + readonly viewerMembership: { + readonly role: MembershipRole; + }; readonly " $fragmentSpreads": FragmentRefs<"MembershipsDropdown_organizationFragment" | "SessionDropdownFragment" | "SidebarFragment">; + } | { + // This will never be '%other', but we need some + // value in case none of the concrete values match. + readonly __typename: "%other"; }; readonly viewer: { readonly pendingInvitations: { @@ -48,10 +57,24 @@ v2 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "totalCount", + "name": "__typename", "storageKey": null }, v3 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "role", + "storageKey": null +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "totalCount", + "storageKey": null +}, +v5 = { "alias": null, "args": null, "kind": "ScalarField", @@ -75,6 +98,7 @@ return { "name": "node", "plural": false, "selections": [ + (v2/*: any*/), { "kind": "InlineFragment", "selections": [ @@ -92,6 +116,22 @@ return { "args": null, "kind": "FragmentSpread", "name": "SidebarFragment" + }, + { + "kind": "RequiredField", + "field": { + "alias": null, + "args": null, + "concreteType": "Membership", + "kind": "LinkedField", + "name": "viewerMembership", + "plural": false, + "selections": [ + (v3/*: any*/) + ], + "storageKey": null + }, + "action": "THROW" } ], "type": "Organization", @@ -129,7 +169,7 @@ return { "selections": [ { "kind": "RequiredField", - "field": (v2/*: any*/), + "field": (v4/*: any*/), "action": "THROW" } ], @@ -160,13 +200,7 @@ return { "name": "node", "plural": false, "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - }, + (v2/*: any*/), { "kind": "InlineFragment", "selections": [ @@ -213,7 +247,7 @@ return { "name": "email", "storageKey": null }, - (v3/*: any*/) + (v5/*: any*/) ], "storageKey": null }, @@ -232,10 +266,11 @@ return { "name": "fullName", "storageKey": null }, - (v3/*: any*/) + (v5/*: any*/) ], "storageKey": null }, + (v5/*: any*/), (v3/*: any*/) ], "storageKey": null @@ -504,7 +539,7 @@ return { "type": "Organization", "abstractKey": null }, - (v3/*: any*/) + (v5/*: any*/) ], "storageKey": null }, @@ -524,27 +559,27 @@ return { "name": "pendingInvitations", "plural": false, "selections": [ - (v2/*: any*/) + (v4/*: any*/) ], "storageKey": null }, - (v3/*: any*/) + (v5/*: any*/) ], "storageKey": null } ] }, "params": { - "cacheID": "7a430121b08c549781c5340bacd630c9", + "cacheID": "f39bc9faafcfb9d3e6482e088a3cae1e", "id": null, "metadata": {}, "name": "MembershipLayoutQuery", "operationKind": "query", - "text": "query MembershipLayoutQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n ...MembershipsDropdown_organizationFragment\n ...SessionDropdownFragment\n ...SidebarFragment\n }\n id\n }\n viewer {\n ...MembershipsDropdown_viewerFragment\n pendingInvitations {\n totalCount\n }\n id\n }\n}\n\nfragment MembershipsDropdown_organizationFragment on Organization {\n name\n}\n\nfragment MembershipsDropdown_viewerFragment on Identity {\n pendingInvitations {\n totalCount\n }\n}\n\nfragment SessionDropdownFragment on Organization {\n canDelete: permission(action: \"iam:organization:delete\")\n viewerMembership {\n identity {\n email\n id\n }\n profile {\n fullName\n id\n }\n id\n }\n}\n\nfragment SidebarFragment on Organization {\n canListMeetings: permission(action: \"core:meeting:list\")\n canListTasks: permission(action: \"core:task:list\")\n canListMeasures: permission(action: \"core:measures:list\")\n canListRisks: permission(action: \"core:risk:list\")\n canListFrameworks: permission(action: \"core:frameworks:list\")\n canListPeople: permission(action: \"core:people:list\")\n canListVendors: permission(action: \"core:vendor:list\")\n canListDocuments: permission(action: \"core:document:list\")\n canListAssets: permission(action: \"core:asset:list\")\n canListData: permission(action: \"core:datum:list\")\n canListAudits: permission(action: \"core:audit:list\")\n canListNonconformities: permission(action: \"core:nonconformity:list\")\n canListObligations: permission(action: \"core:obligation:list\")\n canListContinualImprovements: permission(action: \"core:continual-improvement:list\")\n canListProcessingActivities: permission(action: \"core:processing-activity:list\")\n canListRightsRequests: permission(action: \"core:rights-request:list\")\n canListSnapshots: permission(action: \"core:snapshot:list\")\n canGetTrustCenter: permission(action: \"core:trust-center:get\")\n canUpdateOrganization: permission(action: \"iam:organization:update\")\n canListStatesOfApplicability: permission(action: \"core:state-of-applicability:list\")\n}\n" + "text": "query MembershipLayoutQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n ...MembershipsDropdown_organizationFragment\n ...SessionDropdownFragment\n ...SidebarFragment\n viewerMembership {\n role\n id\n }\n }\n id\n }\n viewer {\n ...MembershipsDropdown_viewerFragment\n pendingInvitations {\n totalCount\n }\n id\n }\n}\n\nfragment MembershipsDropdown_organizationFragment on Organization {\n name\n}\n\nfragment MembershipsDropdown_viewerFragment on Identity {\n pendingInvitations {\n totalCount\n }\n}\n\nfragment SessionDropdownFragment on Organization {\n canDelete: permission(action: \"iam:organization:delete\")\n viewerMembership {\n identity {\n email\n id\n }\n profile {\n fullName\n id\n }\n id\n }\n}\n\nfragment SidebarFragment on Organization {\n canListMeetings: permission(action: \"core:meeting:list\")\n canListTasks: permission(action: \"core:task:list\")\n canListMeasures: permission(action: \"core:measures:list\")\n canListRisks: permission(action: \"core:risk:list\")\n canListFrameworks: permission(action: \"core:frameworks:list\")\n canListPeople: permission(action: \"core:people:list\")\n canListVendors: permission(action: \"core:vendor:list\")\n canListDocuments: permission(action: \"core:document:list\")\n canListAssets: permission(action: \"core:asset:list\")\n canListData: permission(action: \"core:datum:list\")\n canListAudits: permission(action: \"core:audit:list\")\n canListNonconformities: permission(action: \"core:nonconformity:list\")\n canListObligations: permission(action: \"core:obligation:list\")\n canListContinualImprovements: permission(action: \"core:continual-improvement:list\")\n canListProcessingActivities: permission(action: \"core:processing-activity:list\")\n canListRightsRequests: permission(action: \"core:rights-request:list\")\n canListSnapshots: permission(action: \"core:snapshot:list\")\n canGetTrustCenter: permission(action: \"core:trust-center:get\")\n canUpdateOrganization: permission(action: \"iam:organization:update\")\n canListStatesOfApplicability: permission(action: \"core:state-of-applicability:list\")\n}\n" } }; })(); -(node as any).hash = "9a87ccbe2aa86cca7845e0145b133921"; +(node as any).hash = "6e16255ebbb75840ce8ec057a453bbf0"; export default node; diff --git a/apps/console/src/hooks/graph/RightsRequestGraph.ts b/apps/console/src/hooks/graph/RightsRequestGraph.ts index 550fe50d0..5816019e6 100644 --- a/apps/console/src/hooks/graph/RightsRequestGraph.ts +++ b/apps/console/src/hooks/graph/RightsRequestGraph.ts @@ -11,6 +11,7 @@ export const rightsRequestsQuery = graphql` query RightsRequestGraphListQuery($organizationId: ID!) { node(id: $organizationId) { ... on Organization { + canCreateRightsRequest: permission(action: "core:rights-request:create") ...RightsRequestsPageFragment } } @@ -29,6 +30,8 @@ export const rightsRequestNodeQuery = graphql` details deadline actionTaken + canUpdate: permission(action: "core:rights-request:update") + canDelete: permission(action: "core:rights-request:delete") organization { id name diff --git a/apps/console/src/hooks/graph/StateOfApplicabilityGraph.ts b/apps/console/src/hooks/graph/StateOfApplicabilityGraph.ts index cac1e012e..a6bbfd000 100644 --- a/apps/console/src/hooks/graph/StateOfApplicabilityGraph.ts +++ b/apps/console/src/hooks/graph/StateOfApplicabilityGraph.ts @@ -20,8 +20,10 @@ import { useTranslate } from "@probo/i18n"; export const paginatedStateOfApplicabilityQuery = graphql` query StateOfApplicabilityGraphPaginatedQuery($organizationId: ID!) { organization: node(id: $organizationId) { + __typename ... on Organization { id + canCreateStateOfApplicability: permission(action: "core:state-of-applicability:create") ...StateOfApplicabilityGraphPaginatedFragment } } @@ -59,6 +61,9 @@ export const paginatedStateOfApplicabilityFragment = graphql` snapshotId createdAt updatedAt + + canDelete: permission(action: "core:state-of-applicability:delete") + controlsInfo: controls(first: 0) { totalCount } @@ -197,6 +202,8 @@ export const stateOfApplicabilityNodeQuery = graphql` snapshotId createdAt updatedAt + canUpdate: permission(action: "core:state-of-applicability:update") + canDelete: permission(action: "core:state-of-applicability:delete") organization { id } diff --git a/apps/console/src/layouts/MainLayout.tsx b/apps/console/src/layouts/MainLayout.tsx deleted file mode 100644 index 4e3395c61..000000000 --- a/apps/console/src/layouts/MainLayout.tsx +++ /dev/null @@ -1,556 +0,0 @@ -import { useTranslate } from "@probo/i18n"; -import { - Avatar, - Badge, - Button, - Dropdown, - DropdownItem, - DropdownSeparator, - IconArrowBoxLeft, - IconBank, - IconBook, - IconBox, - IconCalendar2, - IconCheckmark1, - IconChevronGrabberVertical, - IconCircleProgress, - IconCircleQuestionmark, - IconClock, - IconCrossLargeX, - IconFire3, - IconGroup1, - IconInboxEmpty, - IconKey, - IconListStack, - IconLock, - IconMagnifyingGlass, - IconMedal, - IconPageTextLine, - IconPeopleAdd, - IconPlusLarge, - IconRotateCw, - IconSettingsGear2, - IconShield, - IconStore, - IconTodo, - Input, - Layout, - SidebarItem, - Skeleton, - UserDropdownItem, - UserDropdown as UserDropdownRoot, - useToast, -} from "@probo/ui"; -import { Suspense, use, useEffect, useMemo, useState } from "react"; -import { ErrorBoundary } from "react-error-boundary"; -import { useLazyLoadQuery } from "react-relay"; -import { Link, Navigate, Outlet, useParams } from "react-router"; -import { graphql } from "relay-runtime"; -import type { MainLayoutQuery as MainLayoutQueryType } from "/__generated__/core/MainLayoutQuery.graphql"; -import { PageError } from "/components/PageError"; -import { PermissionsProvider } from "/providers/PermissionsProvider"; -import { PermissionsContext } from "/providers/PermissionsContext"; - -const MainLayoutQuery = graphql` - query MainLayoutQuery($organizationId: ID!) { - viewer { - id - } - organization: node(id: $organizationId) { - ... on Organization { - id - name - logoUrl - } - } - } -`; - -/** - * Site layout with a header and a sidebar - */ -export function MainLayout() { - const { organizationId } = useParams(); - - const prefix = `/organizations/${organizationId}`; - - if (!organizationId) { - return ; - } - - return ( - }> - - - - - ); -} - -function MainLayoutContent({ - organizationId, - prefix, -}: { - organizationId: string; - prefix: string; -}) { - const { __ } = useTranslate(); - const { isAuthorized } = use(PermissionsContext); - const data = useLazyLoadQuery(MainLayoutQuery, { - organizationId, - }); - - return ( - -
- -
- }> - - - - } - sidebar={ -
    - {isAuthorized("Organization", "listMeetings") && ( - - )} - {isAuthorized("Organization", "listTasks") && ( - - )} - {isAuthorized("Organization", "listMeasures") && ( - - )} - {isAuthorized("Organization", "listRisks") && ( - - )} - {isAuthorized("Organization", "listFrameworks") && ( - - )} - {isAuthorized("Organization", "listPeople") && ( - - )} - {isAuthorized("Organization", "listVendors") && ( - - )} - {isAuthorized("Organization", "listDocuments") && ( - - )} - {isAuthorized("Organization", "listAssets") && ( - - )} - {isAuthorized("Organization", "listData") && ( - - )} - {isAuthorized("Organization", "listAudits") && ( - - )} - {isAuthorized("Organization", "listNonconformities") && ( - - )} - {isAuthorized("Organization", "listObligations") && ( - - )} - {isAuthorized("Organization", "listContinualImprovements") && ( - - )} - {isAuthorized("Organization", "listProcessingActivities") && ( - - )} - {isAuthorized("Organization", "listRightsRequests") && ( - - )} - {isAuthorized("Organization", "listSnapshots") && ( - - )} - {isAuthorized("Organization", "getTrustCenter") && ( - - )} - {isAuthorized("Organization", "listMembers") && ( - - )} -
- } - > - - - -
- ); -} - -function UserDropdown({ organizationId }: { organizationId: string }) { - const { __ } = useTranslate(); - const { toast } = useToast(); - const { isAuthorized } = use(PermissionsContext); - // const user = useLazyLoadQuery(MainLayoutQuery, { - // organizationId, - // }).viewer.user; - const user = { - fullName: "", - email: "", - }; - - const handleLogout: React.MouseEventHandler = async ( - e, - ) => { - e.preventDefault(); - - fetch("/connect/logout", { - method: "DELETE", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({}), - }) - .then(async (res) => { - if (!res.ok) { - const error = await res.json(); - throw new Error(error.message || __("Failed to login")); - } - - window.location.reload(); - }) - .catch((e) => { - toast({ - title: __("Error"), - description: e.message as string, - variant: "error", - }); - }); - }; - - return ( - - {isAuthorized("Organization", "deleteOrganization") && ( - - )} - {isAuthorized("Organization", "listSignableDocuments") && ( - - )} - - - - - ); -} - -interface Organization { - id: string; - name: string; - logoUrl?: string | null; - authenticationMethod: string; - authStatus: "authenticated" | "unauthenticated" | "expired"; - loginUrl: string; -} - -interface OrganizationsResponse { - organizations: Organization[]; -} - -interface Invitation { - id: string; - email: string; - fullName: string; - role: string; - expiresAt: string; - acceptedAt?: string | null; - createdAt: string; - organization: { - id: string; - name: string; - }; -} - -interface InvitationsResponse { - invitations: Invitation[]; -} - -function OrganizationSelector({ - currentOrganization, -}: { - currentOrganization: MainLayoutQueryType["response"]["organization"]; -}) { - const [organizations, setOrganizations] = useState([]); - const [pendingInvitationsCount, setPendingInvitationsCount] = useState(0); - const [isLoading, setIsLoading] = useState(true); - const [error, setError] = useState(null); - const [search, setSearch] = useState(""); - const { __ } = useTranslate(); - - const filteredOrganizations = useMemo(() => { - if (!search.trim()) { - return organizations; - } - return organizations.filter((org) => - org.name.toLowerCase().includes(search.toLowerCase()), - ); - }, [organizations, search]); - - useEffect(() => { - const fetchData = async () => { - try { - setIsLoading(true); - - const [orgsResponse, invitationsResponse] = await Promise.all([ - fetch("/connect/organizations", { credentials: "include" }), - fetch("/connect/invitations", { credentials: "include" }), - ]); - - if (!orgsResponse.ok) { - throw new Error("Failed to fetch organizations"); - } - - if (!invitationsResponse.ok) { - throw new Error("Failed to fetch invitations"); - } - - const orgsData: OrganizationsResponse = await orgsResponse.json(); - const invitationsData: InvitationsResponse = - await invitationsResponse.json(); - - const pendingCount = invitationsData.invitations.filter( - (inv) => !inv.acceptedAt, - ).length; - - setOrganizations(orgsData.organizations); - setPendingInvitationsCount(pendingCount); - setError(null); - } catch (err) { - setError(err instanceof Error ? err.message : "Unknown error"); - console.error("Failed to fetch data:", err); - } finally { - setIsLoading(false); - } - }; - - fetchData(); - }, []); - - if (error) { - return ( -
- -
- ); - } - - return ( -
- - {isLoading ? __("Loading...") : currentOrganization?.name || ""} - - } - > -
- { - e.stopPropagation(); - }} - autoFocus - /> -
-
- {isLoading ? ( -
- {__("Loading organizations...")} -
- ) : filteredOrganizations.length === 0 ? ( -
- {__("No organizations found")} -
- ) : ( - filteredOrganizations.map((organization) => { - const isAuthenticated = - organization.authStatus === "authenticated"; - const isExpired = organization.authStatus === "expired"; - const needsAuth = organization.authStatus === "unauthenticated"; - - const targetUrl = isAuthenticated - ? `/organizations/${organization.id}` - : organization.loginUrl; - - const isSAMLUrl = targetUrl.includes("/connect/saml/"); - - // Use organization endpoint for all logos for consistency - const logoUrl = organization.logoUrl; - - return ( - - {isSAMLUrl ? ( - - - {organization.name} - {isAuthenticated && ( - - )} - {isExpired && ( - - )} - {needsAuth && ( - - )} - - ) : ( - - - {organization.name} - {isAuthenticated && ( - - )} - {isExpired && ( - - )} - {needsAuth && ( - - )} - - )} - - ); - }) - )} -
- - {pendingInvitationsCount > 0 && ( - - - - {__("Invitations")} - - {pendingInvitationsCount} - - - - )} - - - - {__("Add organization")} - - -
- {pendingInvitationsCount > 0 && ( - -
- ); -} diff --git a/apps/console/src/pages/iam/memberships/MembershipLayout.tsx b/apps/console/src/pages/iam/memberships/MembershipLayout.tsx index d324ae81f..d4d4490ce 100644 --- a/apps/console/src/pages/iam/memberships/MembershipLayout.tsx +++ b/apps/console/src/pages/iam/memberships/MembershipLayout.tsx @@ -12,10 +12,14 @@ import { CoreRelayProvider } from "/providers/CoreRelayProvider"; export const membershipLayoutQuery = graphql` query MembershipLayoutQuery($organizationId: ID!) { organization: node(id: $organizationId) @required(action: THROW) { + __typename ... on Organization { ...MembershipsDropdown_organizationFragment ...SessionDropdownFragment ...SidebarFragment + viewerMembership @required(action: THROW) { + role + } } } viewer @required(action: THROW) { @@ -38,6 +42,9 @@ export function MembershipLayout(props: { membershipLayoutQuery, queryRef, ); + if (organization.__typename !== "Organization") { + throw new Error("invalid type for organization node"); + } return ( } > - + ); diff --git a/apps/console/src/pages/organizations/rightsRequests/RightsRequestDetailsPage.tsx b/apps/console/src/pages/organizations/rightsRequests/RightsRequestDetailsPage.tsx index 3af532f0a..de106050d 100644 --- a/apps/console/src/pages/organizations/rightsRequests/RightsRequestDetailsPage.tsx +++ b/apps/console/src/pages/organizations/rightsRequests/RightsRequestDetailsPage.tsx @@ -1,289 +1,318 @@ import { - ConnectionHandler, - usePreloadedQuery, - type PreloadedQuery, + ConnectionHandler, + usePreloadedQuery, + type PreloadedQuery, } from "react-relay"; import { - rightsRequestNodeQuery, - useDeleteRightsRequest, - useUpdateRightsRequest, - RightsRequestsConnectionKey, + rightsRequestNodeQuery, + useDeleteRightsRequest, + useUpdateRightsRequest, + RightsRequestsConnectionKey, } from "../../../hooks/graph/RightsRequestGraph"; import { - ActionDropdown, - Badge, - Breadcrumb, - Button, - DropdownItem, - Field, - Option, - Input, - Card, - Textarea, - useToast, - Select, - Label, + ActionDropdown, + Badge, + Breadcrumb, + Button, + DropdownItem, + Field, + Option, + Input, + Card, + Textarea, + useToast, + Select, + Label, } from "@probo/ui"; import { useTranslate } from "@probo/i18n"; import { useOrganizationId } from "/hooks/useOrganizationId"; import { useFormWithSchema } from "/hooks/useFormWithSchema"; import { Controller } from "react-hook-form"; import { - formatError, - type GraphQLError, - formatDatetime, - toDateInput, - getRightsRequestTypeLabel, - getRightsRequestTypeOptions, - getRightsRequestStateVariant, - getRightsRequestStateLabel, - getRightsRequestStateOptions, + formatError, + type GraphQLError, + formatDatetime, + toDateInput, + getRightsRequestTypeLabel, + getRightsRequestTypeOptions, + getRightsRequestStateVariant, + getRightsRequestStateLabel, + getRightsRequestStateOptions, } from "@probo/helpers"; import z from "zod"; import type { RightsRequestGraphNodeQuery } from "/__generated__/core/RightsRequestGraphNodeQuery.graphql"; -import { use } from "react"; -import { PermissionsContext } from "/providers/PermissionsContext"; const updateRequestSchema = z.object({ - requestType: z.enum(["ACCESS", "DELETION", "PORTABILITY"]), - requestState: z.enum(["TODO", "IN_PROGRESS", "DONE"]), - dataSubject: z.string().optional(), - contact: z.string().optional(), - details: z.string().optional(), - deadline: z.string().optional(), - actionTaken: z.string().optional(), + requestType: z.enum(["ACCESS", "DELETION", "PORTABILITY"]), + requestState: z.enum(["TODO", "IN_PROGRESS", "DONE"]), + dataSubject: z.string().optional(), + contact: z.string().optional(), + details: z.string().optional(), + deadline: z.string().optional(), + actionTaken: z.string().optional(), }); type Props = { - queryRef: PreloadedQuery; + queryRef: PreloadedQuery; }; export default function RightsRequestDetailsPage(props: Props) { - const data = usePreloadedQuery( - rightsRequestNodeQuery, - props.queryRef, - ); - const request = data.node; - const { __ } = useTranslate(); - const { toast } = useToast(); - const organizationId = useOrganizationId(); - const { isAuthorized } = use(PermissionsContext); + const data = usePreloadedQuery( + rightsRequestNodeQuery, + props.queryRef, + ); + const request = data.node; + const { __ } = useTranslate(); + const { toast } = useToast(); + const organizationId = useOrganizationId(); - const updateRequest = useUpdateRightsRequest(); + const updateRequest = useUpdateRightsRequest(); - const connectionId = ConnectionHandler.getConnectionID( - organizationId, - RightsRequestsConnectionKey, - ); + const connectionId = ConnectionHandler.getConnectionID( + organizationId, + RightsRequestsConnectionKey, + ); - const deleteRequest = useDeleteRightsRequest( - { id: request.id! }, - connectionId, - ); + const deleteRequest = useDeleteRightsRequest( + { id: request.id! }, + connectionId, + ); - const { register, handleSubmit, formState, control } = useFormWithSchema( - updateRequestSchema, - { - defaultValues: { - requestType: request.requestType || "ACCESS", - requestState: request.requestState || "TODO", - dataSubject: request.dataSubject || "", - contact: request.contact || "", - details: request.details || "", - deadline: toDateInput(request.deadline), - actionTaken: request.actionTaken || "", - }, - }, - ); + const { register, handleSubmit, formState, control } = useFormWithSchema( + updateRequestSchema, + { + defaultValues: { + requestType: request.requestType || "ACCESS", + requestState: request.requestState || "TODO", + dataSubject: request.dataSubject || "", + contact: request.contact || "", + details: request.details || "", + deadline: toDateInput(request.deadline), + actionTaken: request.actionTaken || "", + }, + }, + ); - const onSubmit = handleSubmit(async (formData) => { - try { - await updateRequest({ - id: request.id!, - requestType: formData.requestType, - requestState: formData.requestState, - dataSubject: formData.dataSubject || undefined, - contact: formData.contact || undefined, - details: formData.details || undefined, - deadline: formatDatetime(formData.deadline) ?? null, - actionTaken: formData.actionTaken || undefined, - }); + const onSubmit = handleSubmit(async (formData) => { + try { + await updateRequest({ + id: request.id!, + requestType: formData.requestType, + requestState: formData.requestState, + dataSubject: formData.dataSubject || undefined, + contact: formData.contact || undefined, + details: formData.details || undefined, + deadline: formatDatetime(formData.deadline) ?? null, + actionTaken: formData.actionTaken || undefined, + }); - toast({ - title: __("Success"), - description: __("Rights request updated successfully"), - variant: "success", - }); - } catch (error) { - toast({ - title: __("Error"), - description: formatError( - __("Failed to update rights request"), - error as GraphQLError, - ), - variant: "error", - }); - } - }); + toast({ + title: __("Success"), + description: __("Rights request updated successfully"), + variant: "success", + }); + } catch (error) { + toast({ + title: __("Error"), + description: formatError( + __("Failed to update rights request"), + error as GraphQLError, + ), + variant: "error", + }); + } + }); - const typeOptions = getRightsRequestTypeOptions(__); - const stateOptions = getRightsRequestStateOptions(__); + const typeOptions = getRightsRequestTypeOptions(__); + const stateOptions = getRightsRequestStateOptions(__); - const breadcrumbRequestsUrl = `/organizations/${organizationId}/rights-requests`; + const breadcrumbRequestsUrl = `/organizations/${organizationId}/rights-requests`; - return ( -
-
- - {isAuthorized("RightsRequest", "deleteRightsRequest") && ( - - - {__("Delete")} - - - )} -
- - -
-
-
-

- {getRightsRequestTypeLabel(__, request.requestType || "ACCESS")} -

- - {getRightsRequestTypeLabel(__, request.requestType || "ACCESS")} - - +
+ + {request.canDelete && ( + + + {__("Delete")} + + )} - > - {getRightsRequestStateLabel(__, request.requestState || "TODO")} - -
-
- -
-
- ( -
- - - {formState.errors.requestType?.message && ( -
- {formState.errors.requestType.message} -
- )} -
- )} - /> - - ( -
- - - {formState.errors.requestState?.message && ( -
- {formState.errors.requestState.message} -
- )} -
- )} - />
- + +
+
+
+

+ {getRightsRequestTypeLabel( + __, + request.requestType || "ACCESS", + )} +

+ + {getRightsRequestTypeLabel( + __, + request.requestType || "ACCESS", + )} + + + {getRightsRequestStateLabel( + __, + request.requestState || "TODO", + )} + +
+
- + +
+ ( +
+ + + {formState.errors.requestType + ?.message && ( +
+ { + formState.errors.requestType + .message + } +
+ )} +
+ )} + /> -
- -