@@ -64,14 +64,12 @@ import {
6464 typedJsonWithErrorMessage ,
6565 typedJsonWithSuccessMessage ,
6666} from "~/models/message.server" ;
67- import { resolveOrgIdFromSlug } from "~/models/organization.server" ;
6867import { findProjectBySlug } from "~/models/project.server" ;
6968import { findEnvironmentBySlug } from "~/models/runtimeEnvironment.server" ;
7069import { ApiKeysPresenter } from "~/presenters/v3/ApiKeysPresenter.server" ;
7170import { useFeatures } from "~/hooks/useFeatures" ;
7271import { useOrganization } from "~/hooks/useOrganizations" ;
7372import { useShowSelfServe } from "~/hooks/useShowSelfServe" ;
74- import { canIssueAdditionalApiKeys } from "~/services/additionalApiKeyIssuance.server" ;
7573import {
7674 validateCreateApiKeyPreset ,
7775 type ApiKeyPreset ,
@@ -135,25 +133,18 @@ export const loader = dashboardLoader(
135133 {
136134 params : EnvironmentParamSchema ,
137135 searchParams : ApiKeySearchParams ,
138- context : async ( params ) => {
139- const organizationId = await resolveOrgIdFromSlug ( params . organizationSlug ) ;
140- return organizationId ? { organizationId } : { } ;
141- } ,
142136 } ,
143- async ( { params, searchParams, user, ability, context } ) => {
137+ async ( { params, searchParams, user, ability } ) => {
144138 try {
145139 const presenter = new ApiKeysPresenter ( ) ;
146- const [ data , additionalApiKeyIssuanceEnabled , isRbacPluginAvailable ] = await Promise . all ( [
140+ const [ data , isRbacPluginAvailable ] = await Promise . all ( [
147141 presenter . call ( {
148142 userId : user . id ,
149143 organizationSlug : params . organizationSlug ,
150144 projectSlug : params . projectParam ,
151145 environmentSlug : params . envParam ,
152146 showRevoked : searchParams . showRevoked ,
153147 } ) ,
154- context . organizationId
155- ? canIssueAdditionalApiKeys ( context . organizationId )
156- : Promise . resolve ( false ) ,
157148 rbac . isUsingPlugin ( ) ,
158149 ] ) ;
159150
@@ -176,7 +167,6 @@ export const loader = dashboardLoader(
176167 apiKeys : canReadApiKeys ? data . apiKeys : [ ] ,
177168 canReadApiKeys,
178169 canWriteApiKeys,
179- additionalApiKeyIssuanceEnabled,
180170 isRbacPluginAvailable,
181171 showRevoked : searchParams . showRevoked ?? false ,
182172 loadedAt : Date . now ( ) ,
@@ -194,10 +184,6 @@ export const loader = dashboardLoader(
194184export const action = dashboardAction (
195185 {
196186 params : EnvironmentParamSchema ,
197- context : async ( params ) => {
198- const organizationId = await resolveOrgIdFromSlug ( params . organizationSlug ) ;
199- return organizationId ? { organizationId } : { } ;
200- } ,
201187 // The environment tier is only known after resolving the route params,
202188 // so write:apiKeys is enforced in the handler before any mutation.
203189 } ,
@@ -241,15 +227,6 @@ export const action = dashboardAction(
241227 try {
242228 switch ( submission . data . action ) {
243229 case "create" : {
244- if ( ! ( await canIssueAdditionalApiKeys ( project . organizationId ) ) ) {
245- const message = "Creating additional API keys is not enabled." ;
246- return typedJsonWithErrorMessage (
247- { ok : false as const , error : message } ,
248- request ,
249- message
250- ) ;
251- }
252-
253230 const presets = await rbac . apiKeyPresets ( project . organizationId ) ;
254231 const preset = validateCreateApiKeyPreset ( {
255232 presets,
@@ -321,7 +298,6 @@ export default function Page() {
321298 apiKeys,
322299 canReadApiKeys,
323300 canWriteApiKeys,
324- additionalApiKeyIssuanceEnabled,
325301 isRbacPluginAvailable,
326302 showRevoked,
327303 hasVercelIntegration,
@@ -386,15 +362,13 @@ export default function Page() {
386362 />
387363 ) : null }
388364 < RevokedFilter checked = { showRevoked } />
389- { additionalApiKeyIssuanceEnabled ? (
390- < NewApiKeyDialog
391- canWrite = { canWriteApiKeys }
392- availableTasks = { availableTasks }
393- presets = { presets }
394- isRbacPluginAvailable = { isRbacPluginAvailable }
395- environment = { apiKeyEnvironmentLabel }
396- />
397- ) : null }
365+ < NewApiKeyDialog
366+ canWrite = { canWriteApiKeys }
367+ availableTasks = { availableTasks }
368+ presets = { presets }
369+ isRbacPluginAvailable = { isRbacPluginAvailable }
370+ environment = { apiKeyEnvironmentLabel }
371+ />
398372 </ div >
399373 </ div >
400374
0 commit comments