From 2c112ae47d9ed7915ba43f84acf1d2925ea49caa Mon Sep 17 00:00:00 2001 From: starptech Date: Tue, 9 Apr 2024 02:07:37 +0200 Subject: [PATCH] chore: revert api key restriction --- .../src/pages/[organizationSlug]/apikeys.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/studio/src/pages/[organizationSlug]/apikeys.tsx b/studio/src/pages/[organizationSlug]/apikeys.tsx index af5e0422e1..9662f203cb 100644 --- a/studio/src/pages/[organizationSlug]/apikeys.tsx +++ b/studio/src/pages/[organizationSlug]/apikeys.tsx @@ -144,7 +144,7 @@ const CreateAPIKeyDialog = ({ selectedFedGraphs.length === 0 && selectedSubgraphs.length === 0 ) { - setErrorMsg("Please select atleast one of the resource."); + setErrorMsg("Please select at least one of the resource."); return; } @@ -197,6 +197,22 @@ const CreateAPIKeyDialog = ({ return result; }, {}); + // When rbac is enabled and this is the case for enterprise users + // you can only create an API key if you are an admin or have access to at least one federated graph or subgraph + if ( + rbac && + !(isAdmin || federatedGraphs.length > 0 || subgraphs.length > 0) + ) { + return ( + + ); + } + const groupedFederatedGraphs = federatedGraphs.reduce< Record >((result, graph) => {