Skip to content

Commit

Permalink
chore: revert api key restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
StarpTech committed Apr 9, 2024
1 parent c473a28 commit 2c112ae
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion studio/src/pages/[organizationSlug]/apikeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 (
<Button disabled>
<div className="flex items-center gap-x-2">
<PlusIcon />
<span>New API key</span>
</div>
</Button>
);
}

const groupedFederatedGraphs = federatedGraphs.reduce<
Record<string, GetUserAccessibleResourcesResponse_Graph[]>
>((result, graph) => {
Expand Down

0 comments on commit 2c112ae

Please sign in to comment.