Fix nonconformity pages permission handling

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-12-31 18:57:44 +01:00
committed by Bryan Frimin
parent 65d3267ab8
commit 04aecdd7e5
8 changed files with 238 additions and 73 deletions

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<310dfd9974ac15af86b8e8ecf21d2b5c>>
* @generated SignedSource<<8137b73b0ad40930966c6feb6370420b>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -25,6 +25,8 @@ export type NonconformitiesPageFragment$data = {
readonly id: string;
readonly name: string | null | undefined;
} | null | undefined;
readonly canDelete: boolean;
readonly canUpdate: boolean;
readonly correctiveAction: string | null | undefined;
readonly createdAt: any;
readonly dateIdentified: any | null | undefined;
@@ -292,6 +294,32 @@ return {
"name": "updatedAt",
"storageKey": null
},
{
"alias": "canUpdate",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:update"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:update\")"
},
{
"alias": "canDelete",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:delete"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:delete\")"
},
{
"alias": null,
"args": null,
@@ -358,6 +386,6 @@ return {
};
})();
(node as any).hash = "0043855d2410d9ab1fd8fceda53f7c5a";
(node as any).hash = "57f7e0fb2efff357af936edf90e14876";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<5e8c575bf254c267b0694d9c7dd20a82>>
* @generated SignedSource<<c51c49b6699276336c3e5a4cc9a43998>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -315,6 +315,32 @@ return {
"name": "updatedAt",
"storageKey": null
},
{
"alias": "canUpdate",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:update"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:update\")"
},
{
"alias": "canDelete",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:delete"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:delete\")"
},
(v8/*: any*/)
],
"storageKey": null
@@ -390,16 +416,16 @@ return {
]
},
"params": {
"cacheID": "d0fe732fcd104cafd8dec7748d5f3971",
"cacheID": "3876389521eec8e9737e5939cff3d95a",
"id": null,
"metadata": {},
"name": "NonconformitiesPageRefetchQuery",
"operationKind": "query",
"text": "query NonconformitiesPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $snapshotId: ID = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...NonconformitiesPageFragment_35e0S5\n id\n }\n}\n\nfragment NonconformitiesPageFragment_35e0S5 on Organization {\n id\n nonconformities(first: $first, after: $after, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n referenceId\n snapshotId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
"text": "query NonconformitiesPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $snapshotId: ID = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...NonconformitiesPageFragment_35e0S5\n id\n }\n}\n\nfragment NonconformitiesPageFragment_35e0S5 on Organization {\n id\n nonconformities(first: $first, after: $after, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n referenceId\n snapshotId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:nonconformity:update\")\n canDelete: permission(action: \"core:nonconformity:delete\")\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
}
};
})();
(node as any).hash = "0043855d2410d9ab1fd8fceda53f7c5a";
(node as any).hash = "57f7e0fb2efff357af936edf90e14876";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<db7fca9f154989ebab9e5c9b0f5bfd85>>
* @generated SignedSource<<77c22921ec67a1fb75f743dba1685698>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -37,6 +37,8 @@ export type NonconformityGraphCreateMutation$data = {
};
readonly id: string;
} | null | undefined;
readonly canDelete: boolean;
readonly canUpdate: boolean;
readonly createdAt: any;
readonly dateIdentified: any | null | undefined;
readonly description: string | null | undefined;
@@ -157,6 +159,32 @@ v12 = {
"kind": "ScalarField",
"name": "createdAt",
"storageKey": null
},
v13 = {
"alias": "canUpdate",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:update"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:update\")"
},
v14 = {
"alias": "canDelete",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:delete"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:delete\")"
};
return {
"fragment": {
@@ -224,7 +252,9 @@ return {
"storageKey": null
},
(v11/*: any*/),
(v12/*: any*/)
(v12/*: any*/),
(v13/*: any*/),
(v14/*: any*/)
],
"storageKey": null
}
@@ -304,7 +334,9 @@ return {
"storageKey": null
},
(v11/*: any*/),
(v12/*: any*/)
(v12/*: any*/),
(v13/*: any*/),
(v14/*: any*/)
],
"storageKey": null
}
@@ -333,16 +365,16 @@ return {
]
},
"params": {
"cacheID": "ad0967f3684a882d198eaa853a691d34",
"cacheID": "a6643ead6aba7ef0e9e25dcf889c51e5",
"id": null,
"metadata": {},
"name": "NonconformityGraphCreateMutation",
"operationKind": "mutation",
"text": "mutation NonconformityGraphCreateMutation(\n $input: CreateNonconformityInput!\n) {\n createNonconformity(input: $input) {\n nonconformityEdge {\n node {\n id\n referenceId\n description\n status\n dateIdentified\n dueDate\n rootCause\n audit {\n id\n framework {\n name\n id\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n }\n }\n }\n}\n"
"text": "mutation NonconformityGraphCreateMutation(\n $input: CreateNonconformityInput!\n) {\n createNonconformity(input: $input) {\n nonconformityEdge {\n node {\n id\n referenceId\n description\n status\n dateIdentified\n dueDate\n rootCause\n audit {\n id\n framework {\n name\n id\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n canUpdate: permission(action: \"core:nonconformity:update\")\n canDelete: permission(action: \"core:nonconformity:delete\")\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "2a62fc6f16eb6677eecd1cd35de01a16";
(node as any).hash = "198593806928185e34490d5c656e70ca";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<8cce006e13ed2bf7b80b12faab4034c0>>
* @generated SignedSource<<0da0e157ba973f1ae3e2a60d750b8c0d>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -16,6 +16,7 @@ export type NonconformityGraphListQuery$variables = {
};
export type NonconformityGraphListQuery$data = {
readonly node: {
readonly canCreateNonconformity?: boolean;
readonly " $fragmentSpreads": FragmentRefs<"NonconformitiesPageFragment">;
};
};
@@ -44,30 +45,43 @@ v1 = [
"variableName": "organizationId"
}
],
v2 = [
v2 = {
"alias": "canCreateNonconformity",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:create"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:create\")"
},
v3 = [
{
"kind": "Variable",
"name": "snapshotId",
"variableName": "snapshotId"
}
],
v3 = {
v4 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v4 = {
v5 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v5 = [
v6 = [
{
"fields": (v2/*: any*/),
"fields": (v3/*: any*/),
"kind": "ObjectValue",
"name": "filter"
},
@@ -77,7 +91,7 @@ v5 = [
"value": 10
}
],
v6 = {
v7 = {
"alias": null,
"args": null,
"kind": "ScalarField",
@@ -102,8 +116,9 @@ return {
{
"kind": "InlineFragment",
"selections": [
(v2/*: any*/),
{
"args": (v2/*: any*/),
"args": (v3/*: any*/),
"kind": "FragmentSpread",
"name": "NonconformitiesPageFragment"
}
@@ -132,14 +147,15 @@ return {
"name": "node",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
(v5/*: any*/),
{
"kind": "InlineFragment",
"selections": [
(v2/*: any*/),
{
"alias": null,
"args": (v5/*: any*/),
"args": (v6/*: any*/),
"concreteType": "NonconformityConnection",
"kind": "LinkedField",
"name": "nonconformities",
@@ -168,7 +184,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v4/*: any*/),
(v5/*: any*/),
{
"alias": null,
"args": null,
@@ -240,8 +256,8 @@ return {
"name": "audit",
"plural": false,
"selections": [
(v4/*: any*/),
(v6/*: any*/),
(v5/*: any*/),
(v7/*: any*/),
{
"alias": null,
"args": null,
@@ -250,8 +266,8 @@ return {
"name": "framework",
"plural": false,
"selections": [
(v4/*: any*/),
(v6/*: any*/)
(v5/*: any*/),
(v7/*: any*/)
],
"storageKey": null
}
@@ -266,7 +282,7 @@ return {
"name": "owner",
"plural": false,
"selections": [
(v4/*: any*/),
(v5/*: any*/),
{
"alias": null,
"args": null,
@@ -291,7 +307,33 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v3/*: any*/)
{
"alias": "canUpdate",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:update"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:update\")"
},
{
"alias": "canDelete",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:delete"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:delete\")"
},
(v4/*: any*/)
],
"storageKey": null
},
@@ -347,7 +389,7 @@ return {
},
{
"alias": null,
"args": (v5/*: any*/),
"args": (v6/*: any*/),
"filters": [
"filter"
],
@@ -366,16 +408,16 @@ return {
]
},
"params": {
"cacheID": "59c8bf68d04fd47f3d5e3e7d452e2e5e",
"cacheID": "96b967c48f7366ffeab39d39fa7221b2",
"id": null,
"metadata": {},
"name": "NonconformityGraphListQuery",
"operationKind": "query",
"text": "query NonconformityGraphListQuery(\n $organizationId: ID!\n $snapshotId: ID\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...NonconformitiesPageFragment_3iomuz\n }\n id\n }\n}\n\nfragment NonconformitiesPageFragment_3iomuz on Organization {\n id\n nonconformities(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n referenceId\n snapshotId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
"text": "query NonconformityGraphListQuery(\n $organizationId: ID!\n $snapshotId: ID\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateNonconformity: permission(action: \"core:nonconformity:create\")\n ...NonconformitiesPageFragment_3iomuz\n }\n id\n }\n}\n\nfragment NonconformitiesPageFragment_3iomuz on Organization {\n id\n nonconformities(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n referenceId\n snapshotId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:nonconformity:update\")\n canDelete: permission(action: \"core:nonconformity:delete\")\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
}
};
})();
(node as any).hash = "4b416f25dfb07189adceb1cdec2df4e3";
(node as any).hash = "535dfc28b086e0f5a0ffb2f40cac2d89";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<526115183274c5c81a5a70c16012591e>>
* @generated SignedSource<<97f85a5e54306b3b401a123c1d0fc41c>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -22,6 +22,8 @@ export type NonconformityGraphNodeQuery$data = {
};
readonly id: string;
} | null | undefined;
readonly canDelete?: boolean;
readonly canUpdate?: boolean;
readonly correctiveAction?: string | null | undefined;
readonly createdAt?: any;
readonly dateIdentified?: any | null | undefined;
@@ -208,6 +210,32 @@ v17 = {
"kind": "ScalarField",
"name": "updatedAt",
"storageKey": null
},
v18 = {
"alias": "canUpdate",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:update"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:update\")"
},
v19 = {
"alias": "canDelete",
"args": [
{
"kind": "Literal",
"name": "action",
"value": "core:nonconformity:delete"
}
],
"kind": "ScalarField",
"name": "permission",
"storageKey": "permission(action:\"core:nonconformity:delete\")"
};
return {
"fragment": {
@@ -241,7 +269,9 @@ return {
(v14/*: any*/),
(v15/*: any*/),
(v16/*: any*/),
(v17/*: any*/)
(v17/*: any*/),
(v18/*: any*/),
(v19/*: any*/)
],
"type": "Nonconformity",
"abstractKey": null
@@ -291,7 +321,9 @@ return {
(v14/*: any*/),
(v15/*: any*/),
(v16/*: any*/),
(v17/*: any*/)
(v17/*: any*/),
(v18/*: any*/),
(v19/*: any*/)
],
"type": "Nonconformity",
"abstractKey": null
@@ -302,16 +334,16 @@ return {
]
},
"params": {
"cacheID": "e394317a8e7661c374224c08c6fd5b0b",
"cacheID": "f917aa1ad5d7628a6193743a18c9aab9",
"id": null,
"metadata": {},
"name": "NonconformityGraphNodeQuery",
"operationKind": "query",
"text": "query NonconformityGraphNodeQuery(\n $nonconformityId: ID!\n) {\n node(id: $nonconformityId) {\n __typename\n ... on Nonconformity {\n id\n snapshotId\n referenceId\n description\n dateIdentified\n rootCause\n correctiveAction\n dueDate\n status\n effectivenessCheck\n audit {\n id\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n organization {\n id\n name\n }\n createdAt\n updatedAt\n }\n id\n }\n}\n"
"text": "query NonconformityGraphNodeQuery(\n $nonconformityId: ID!\n) {\n node(id: $nonconformityId) {\n __typename\n ... on Nonconformity {\n id\n snapshotId\n referenceId\n description\n dateIdentified\n rootCause\n correctiveAction\n dueDate\n status\n effectivenessCheck\n audit {\n id\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n organization {\n id\n name\n }\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:nonconformity:update\")\n canDelete: permission(action: \"core:nonconformity:delete\")\n }\n id\n }\n}\n"
}
};
})();
(node as any).hash = "e57a600fda9f0f5a0178818df75b0436";
(node as any).hash = "6d1ecfb7df432a591c7e16461842796d";
export default node;