Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update OAuth client references to OAuth app in codebase

Kiran Kd4452be130b7
diff --git a/apps/web/app/api/oauth-apps/[clientId]/route.ts b/apps/web/app/api/oauth-apps/[clientId]/route.ts
index 6cb276aec2..fe90b00303 100644
--- a/apps/web/app/api/oauth-apps/[clientId]/route.ts
+++ b/apps/web/app/api/oauth-apps/[clientId]/route.ts
@@ -2,10 +2,7 @@ import { DubApiError } from "@/lib/api/errors";
import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
-import {
- oAuthAppSchema,
- updateOAuthClientSchema,
-} from "@/lib/zod/schemas/oauth";
+import { oAuthAppSchema, updateOAuthAppSchema } from "@/lib/zod/schemas/oauth";
import { NextResponse } from "next/server";
// GET /api/oauth-apps/[clientId] – get an OAuth app
@@ -35,8 +32,8 @@ export const GET = withWorkspace(
// PATCH /api/oauth-apps/[clientId] – update an OAuth app
export const PATCH = withWorkspace(
async ({ req, params, workspace }) => {
- const { name, developer, website, redirectUri, scopes } =
- updateOAuthClientSchema.parse(await parseRequestBody(req));
+ const { name, developer, website, redirectUri } =
+ updateOAuthAppSchema.parse(await parseRequestBody(req));
const app = await prisma.oAuthApp.update({
where: {
@@ -48,7 +45,6 @@ export const PATCH = withWorkspace(
...(developer && { developer }),
...(website && { website }),
...(redirectUri && { redirectUri }),
- ...(scopes && { scopes: [...new Set(scopes)].join(" ") }),
},
});
diff --git a/apps/web/app/api/oauth-apps/route.ts b/apps/web/app/api/oauth-apps/route.ts
index 24fd63db77..475157fa94 100644
--- a/apps/web/app/api/oauth-apps/route.ts
+++ b/apps/web/app/api/oauth-apps/route.ts
@@ -2,14 +2,11 @@ import {
OAUTH_CLIENT_ID_LENGTH,
OAUTH_CLIENT_SECRET_LENGTH,
OAUTH_CLIENT_SECRET_PREFIX,
-} from "@/lib/api/oauth";
+} from "@/lib/api/oauth/constants";
import { parseRequestBody } from "@/lib/api/utils";
import { hashToken, withWorkspace } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
-import {
- createOAuthClientSchema,
- oAuthAppSchema,
-} from "@/lib/zod/schemas/oauth";
+import { createOAuthAppSchema, oAuthAppSchema } from "@/lib/zod/schemas/oauth";
import { nanoid } from "@dub/utils";
import { NextResponse } from "next/server";
import { z } from "zod";
@@ -17,8 +14,8 @@ import { z } from "zod";
// POST /api/oauth-apps - create a new OAuth apps
export const POST = withWorkspace(
async ({ req, workspace, session }) => {
- const { name, developer, website, redirectUri, scopes } =
- createOAuthClientSchema.parse(await parseRequestBody(req));
+ const { name, developer, website, redirectUri } =
+ createOAuthAppSchema.parse(await parseRequestBody(req));
const clientSecret = `${OAUTH_CLIENT_SECRET_PREFIX}${nanoid(OAUTH_CLIENT_SECRET_LENGTH)}`;
@@ -29,13 +26,17 @@ export const POST = withWorkspace(
developer,
website,
redirectUri,
- scopes: [...new Set(scopes)].join(" "),
clientId: nanoid(OAUTH_CLIENT_ID_LENGTH),
clientSecretHashed: await hashToken(clientSecret),
createdBy: session.user.id,
},
});
+ console.log({
+ ...oAuthAppSchema.parse(client),
+ clientSecret,
+ });
+
return NextResponse.json(
{
...oAuthAppSchema.parse(client),
diff --git a/apps/web/app/api/oauth/authorize/route.ts b/apps/web/app/api/oauth/authorize/route.ts
index d150841941..cfa31430a3 100644
--- a/apps/web/app/api/oauth/authorize/route.ts
+++ b/apps/web/app/api/oauth/authorize/route.ts
@@ -1,4 +1,8 @@
-import { OAUTH_CODE_LENGTH, OAUTH_CODE_LIFETIME } from "@/lib/api/oauth";
+import { DubApiError } from "@/lib/api/errors";
+import {
+ OAUTH_CODE_LENGTH,
+ OAUTH_CODE_LIFETIME,
+} from "@/lib/api/oauth/constants";
import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
@@ -8,8 +12,12 @@ import { NextResponse } from "next/server";
// POST /api/oauth/authorize - approve OAuth authorization request
export const POST = withWorkspace(async ({ session, req, workspace }) => {
- const body = authorizeRequestSchema.parse(await parseRequestBody(req));
- const { state, client_id: clientId, redirect_uri: redirectUri } = body;
+ const {
+ state,
+ client_id: clientId,
+ redirect_uri: redirectUri,
+ scope,
+ } = authorizeRequestSchema.parse(await parseRequestBody(req));
const oAuthApp = await prisma.oAuthApp.findUniqueOrThrow({
where: {
@@ -17,13 +25,20 @@ export const POST = withWorkspace(async ({ session, req, workspace }) => {
},
});
+ if (oAuthApp.redirectUri !== redirectUri) {
+ throw new DubApiError({
+ code: "bad_request",
+ message: "Invalid redirect_uri parameter for the application.",
+ });
+ }
+
const { code } = await prisma.oAuthCode.create({
data: {
clientId,
redirectUri,
projectId: workspace.id,
userId: session.user.id,
- scopes: oAuthApp.scopes,
+ scopes: scope.join(" "),
code: nanoid(OAUTH_CODE_LENGTH),
expiresAt: new Date(Date.now() + OAUTH_CODE_LIFETIME * 1000),
},
diff --git a/apps/web/app/api/oauth/token/exchange-code-for-token.ts b/apps/web/app/api/oauth/token/exchange-code-for-token.ts
index 62d33e8b3d..8fe4a1678b 100644
--- a/apps/web/app/api/oauth/token/exchange-code-for-token.ts
+++ b/apps/web/app/api/oauth/token/exchange-code-for-token.ts
@@ -6,7 +6,7 @@ import {
OAUTH_REFRESH_TOKEN_LENGTH,
OAUTH_REFRESH_TOKEN_LIFETIME,
OAUTH_REFRESH_TOKEN_PREFIX,
-} from "@/lib/api/oauth";
+} from "@/lib/api/oauth/constants";
import { getAuthTokenOrThrow, hashToken } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
import z from "@/lib/zod";
diff --git a/apps/web/app/api/oauth/token/refresh-access-token.ts b/apps/web/app/api/oauth/token/refresh-access-token.ts
index b0ecf3d17f..88be4bf65e 100644
--- a/apps/web/app/api/oauth/token/refresh-access-token.ts
+++ b/apps/web/app/api/oauth/token/refresh-access-token.ts
@@ -6,7 +6,7 @@ import {
OAUTH_REFRESH_TOKEN_LENGTH,
OAUTH_REFRESH_TOKEN_LIFETIME,
OAUTH_REFRESH_TOKEN_PREFIX,
-} from "@/lib/api/oauth";
+} from "@/lib/api/oauth/constants";
import { getAuthTokenOrThrow, hashToken } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
import z from "@/lib/zod";
diff --git a/apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsx b/apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsx
index 5d131aa64c..da281c1276 100644
--- a/apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsx
+++ b/apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsx
@@ -5,17 +5,21 @@ import z from "@/lib/zod";
import { authorizeRequestSchema } from "@/lib/zod/schemas/oauth";
import { Button, InputSelect, InputSelectItemProps } from "@dub/ui";
import { DICEBEAR_AVATAR_URL } from "@dub/utils";
-import { OAuthClient } from "@prisma/client";
+import { OAuthApp } from "@prisma/client";
import { useMemo, useState } from "react";
import { toast } from "sonner";
interface AuthorizeFormProps extends z.infer<typeof authorizeRequestSchema> {
- oAuthApp: Pick<OAuthClient, "name">;
+ oAuthApp: Pick<OAuthApp, "name">;
}
-export const AuthorizeForm = (props: AuthorizeFormProps) => {
- const { oAuthApp, client_id, redirect_uri, response_type, state } = props;
-
+export const AuthorizeForm = ({
+ client_id,
+ redirect_uri,
+ response_type,
+ state,
+ scope,
+}: AuthorizeFormProps) => {
const { workspaces } = useWorkspaces();
const [submitting, setSubmitting] = useState(false);
const [selectedWorkspace, setSelectedWorkspace] =
@@ -71,6 +75,7 @@ export const AuthorizeForm = (props: AuthorizeFormProps) => {
<input type="hidden" name="redirect_uri" value={redirect_uri} />
<input type="hidden" name="response_type" value={response_type} />
<input type="hidden" name="state" value={state} />
+ <input type="hidden" name="scope" value={scope.join(",")} />
<p className="text-sm text-gray-500">
Select a workspace to grant API access to
</p>
diff --git a/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx b/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx
index b5fcebb91c..9c6363f28c 100644
--- a/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx
+++ b/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx
@@ -1,5 +1,5 @@
+import { vaidateAuthorizeRequest } from "@/lib/api/oauth/actions";
import { getSession } from "@/lib/auth";
-import { vaidateAuthorizeRequest } from "@/lib/oauth";
import z from "@/lib/zod";
import { authorizeRequestSchema } from "@/lib/zod/schemas/oauth";
import { Logo } from "@dub/ui";
@@ -70,7 +70,7 @@ export default async function Authorize({
</span>
</div>
<div className="flex flex-col space-y-3 bg-white px-2 py-6 sm:px-10">
- <ScopesRequested scopesRequested={oAuthApp.scopes.split(" ")} />
+ <ScopesRequested scopes={requestParams.scope} />
</div>
<div className="flex flex-col space-y-2 border-t border-gray-200 bg-white px-2 py-6 sm:px-10">
<Suspense fallback={<></>}>
diff --git a/apps/web/app/app.dub.co/(auth)/oauth/authorize/scopes-requested.tsx b/apps/web/app/app.dub.co/(auth)/oauth/authorize/scopes-requested.tsx
index ae2a7bc30c..ff8203c361 100644
--- a/apps/web/app/app.dub.co/(auth)/oauth/authorize/scopes-requested.tsx
+++ b/apps/web/app/app.dub.co/(auth)/oauth/authorize/scopes-requested.tsx
@@ -1,26 +1,27 @@
"use client";
-import { permissions } from "@/lib/api/tokens/scopes";
+import { OAUTH_SCOPE_DESCRIPTIONS } from "@/lib/api/oauth/constants";
import { Check } from "lucide-react";
interface ScopesProps {
- scopesRequested: string[];
+ scopes: string[];
}
-export const ScopesRequested = (props: ScopesProps) => {
- const { scopesRequested } = props;
-
- const requestedPermissions = permissions.filter((p) =>
- scopesRequested.includes(p.scope),
- );
+export const ScopesRequested = ({ scopes }: ScopesProps) => {
+ const scopeWithDescriptions = scopes.map((scope) => {
+ return {
+ scope,
+ description: OAUTH_SCOPE_DESCRIPTIONS[scope],
+ };
+ });
- requestedPermissions.forEach((permission) => {
- permission.description = permission.description.replace(
+ scopeWithDescriptions.forEach((scope) => {
+ scope.description = scope.description.replace(
"Write",
"<strong className='font-medium'>Write</strong>",
);
- permission.description = permission.description.replace(
+ scope.description = scope.description.replace(
"Read",
"<strong className='font-medium'>Read</strong>",
);
@@ -30,13 +31,11 @@ export const ScopesRequested = (props: ScopesProps) => {
<>
<span className="text-gray-600">Grant permissions:</span>
<ul className="text-md space-y-1">
- {requestedPermissions.map((permission) => {
+ {scopeWithDescriptions.map((scope) => {
return (
- <li className="flex items-center gap-2" key={permission.scope}>
+ <li className="flex items-center gap-2" key={scope.scope}>
<Check className="h-4 w-4 text-green-500" />
- <div
- dangerouslySetInnerHTML={{ __html: permission.description }}
- />
+ <div dangerouslySetInnerHTML={{ __html: scope.description }} />
</li>
);
})}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx
index b8a8c2e65c..e5ab9371f1 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx
@@ -52,7 +52,7 @@ export default function AuthorizedAppsPageClient() {
<div className="flex flex-col items-center justify-center gap-y-4 py-20">
<EmptyState
icon={Key}
- title="You have not yet authorized any applications to connect with your Dub workspace."
+ title="You haven’t authorized any applications to access Dub workspace on your behalf."
/>
</div>
)}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx
index 77c1004a7b..39777af1a2 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx
@@ -124,7 +124,7 @@ const AppRow = (app: OAuthAppProps) => {
<p className="font-semibold text-gray-700">{app.name}</p>
<div className="flex items-center gap-x-2">
<p className="text-sm text-gray-500" suppressHydrationWarning>
- {app.scopes.length} access scopes
+ {app.developer}
</p>
</div>
</div>
diff --git a/apps/web/lib/api/oauth.ts b/apps/web/lib/api/oauth.ts
deleted file mode 100644
index 78832b45b2..0000000000
--- a/apps/web/lib/api/oauth.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-// Lifetime in seconds
-export const OAUTH_ACCESS_TOKEN_LIFETIME = 2 * 60 * 60; // 2 hours
-export const OAUTH_REFRESH_TOKEN_LIFETIME = 60 * 24 * 60 * 60; // 60 days
-export const OAUTH_CODE_LIFETIME = 2 * 60; // 2 minutes
-
-export const OAUTH_CLIENT_ID_LENGTH = 32;
-export const OAUTH_CLIENT_SECRET_LENGTH = 32;
-export const OAUTH_ACCESS_TOKEN_LENGTH = 40;
-export const OAUTH_REFRESH_TOKEN_LENGTH = 40;
-export const OAUTH_CODE_LENGTH = 40;
-
-// TODO:
-// Keep it short and simple (Discuss with Steven)
-export const OAUTH_CLIENT_SECRET_PREFIX = "dub_app_secret_";
-export const OAUTH_ACCESS_TOKEN_PREFIX = "dub_access_token_";
-export const OAUTH_REFRESH_TOKEN_PREFIX = "dub_refresh_token_";
diff --git a/apps/web/lib/oauth.ts b/apps/web/lib/api/oauth/actions.ts
similarity index 74%
rename from apps/web/lib/oauth.ts
rename to apps/web/lib/api/oauth/actions.ts
index af2eab3539..588569ef45 100644
--- a/apps/web/lib/oauth.ts
+++ b/apps/web/lib/api/oauth/actions.ts
@@ -1,8 +1,8 @@
"use server";
import { prisma } from "@/lib/prisma";
-import { fromZodError } from "./api/errors";
-import { authorizeRequestSchema } from "./zod/schemas/oauth";
+import { authorizeRequestSchema } from "../../zod/schemas/oauth";
+import { fromZodError } from "../errors";
export const vaidateAuthorizeRequest = async (params: any) => {
const request = authorizeRequestSchema.safeParse(params);
@@ -16,7 +16,11 @@ export const vaidateAuthorizeRequest = async (params: any) => {
}
const requestParams = request.data;
- const { client_id: clientId, redirect_uri: redirectUri } = requestParams;
+ const {
+ client_id: clientId,
+ redirect_uri: redirectUri,
+ scope,
+ } = requestParams;
const oAuthApp = await prisma.oAuthApp.findFirst({
where: {
@@ -36,6 +40,9 @@ export const vaidateAuthorizeRequest = async (params: any) => {
};
}
+ // TODO:
+ // Validate scope requested are valid
+
return {
oAuthApp,
requestParams,
diff --git a/apps/web/lib/api/oauth/constants.ts b/apps/web/lib/api/oauth/constants.ts
new file mode 100644
index 0000000000..ca3694e555
--- /dev/null
+++ b/apps/web/lib/api/oauth/constants.ts
@@ -0,0 +1,44 @@
+// Lifetime in seconds
+export const OAUTH_ACCESS_TOKEN_LIFETIME = 2 * 60 * 60; // 2 hours
+export const OAUTH_REFRESH_TOKEN_LIFETIME = 60 * 24 * 60 * 60; // 60 days
+export const OAUTH_CODE_LIFETIME = 2 * 60; // 2 minutes
+
+export const OAUTH_CLIENT_ID_LENGTH = 32;
+export const OAUTH_CLIENT_SECRET_LENGTH = 32;
+export const OAUTH_ACCESS_TOKEN_LENGTH = 40;
+export const OAUTH_REFRESH_TOKEN_LENGTH = 40;
+export const OAUTH_CODE_LENGTH = 40;
+
+// TODO:
+// Keep it short and simple (Discuss with Steven)
+export const OAUTH_CLIENT_SECRET_PREFIX = "dub_app_secret_";
+export const OAUTH_ACCESS_TOKEN_PREFIX = "dub_access_token_";
+export const OAUTH_REFRESH_TOKEN_PREFIX = "dub_refresh_token_";
+
+// These are the scopes an OAuth app can request on behalf of an user
+export const OAUTH_SCOPES = [
+ "workspaces.read",
+ "workspaces.write",
+ "links.read",
+ "links.write",
+ "tags.read",
+ "tags.write",
+ "analytics.read",
+ "domains.read",
+ "domains.write",
+ "users.read",
+];
+
+// Scope descriptions
+export const OAUTH_SCOPE_DESCRIPTIONS = {
+ "users.read": "Read access to your profile",
+ "workspaces.read": "Read access to workspace",
+ "workspaces.write": "Read and Write access to workspace",
+ "links.read": "Read access to links",
+ "links.write": "Read and Write access to links",
+ "tags.read": "Read access to tags",
+ "tags.write": "Read and Write access to tags",
+ "analytics.read": "Read access to analytics and events",
+ "domains.read": "Read access to domains",
+ "domains.write": "Read and Write access to domains",
+};
diff --git a/apps/web/lib/zod/schemas/oauth.ts b/apps/web/lib/zod/schemas/oauth.ts
index 38d4115484..4c35b2ff59 100644
--- a/apps/web/lib/zod/schemas/oauth.ts
+++ b/apps/web/lib/zod/schemas/oauth.ts
@@ -1,4 +1,4 @@
-import { availableScopes } from "@/lib/api/tokens/scopes";
+import { OAUTH_SCOPES } from "@/lib/api/oauth/constants";
import { z } from "zod";
export const oAuthAppSchema = z.object({
@@ -8,13 +8,9 @@ export const oAuthAppSchema = z.object({
developer: z.string(),
website: z.string(),
redirectUri: z.string(),
- scopes: z
- .string()
- .nullable()
- .transform((val) => val?.split(" ") ?? []),
});
-export const createOAuthClientSchema = z.object({
+export const createOAuthAppSchema = z.object({
name: z.string().min(1).max(255),
developer: z.string().min(1).max(255),
website: z
@@ -40,12 +36,9 @@ export const createOAuthClientSchema = z.object({
"redirect_uri must be a valid URL starting with 'https://' except for 'http://localhost'",
},
),
- scopes: z
- .array(z.enum(availableScopes))
- .min(1, "An OAuth app must have at least one scope"),
});
-export const updateOAuthClientSchema = createOAuthClientSchema.partial();
+export const updateOAuthAppSchema = createOAuthAppSchema.partial();
// Schema for OAuth2.0 Authorization request
export const authorizeRequestSchema = z.object({
@@ -55,6 +48,19 @@ export const authorizeRequestSchema = z.object({
message: "response_type must be 'code'",
}),
state: z.string().max(255).optional(),
+ scope: z
+ .string()
+ .max(255)
+ .nullable()
+ .transform((scope) => scope?.split(",") ?? [])
+ .refine(
+ (scopes) => {
+ return scopes.every((scope) => OAUTH_SCOPES.includes(scope));
+ },
+ {
+ message: "Invalid scopes",
+ },
+ ),
});
// Schema for OAuth2.0 code exchange request
diff --git a/apps/web/prisma/schema.prisma b/apps/web/prisma/schema.prisma
index d03c47a03d..c804c60ef8 100644
--- a/apps/web/prisma/schema.prisma
+++ b/apps/web/prisma/schema.prisma
@@ -375,7 +375,6 @@ model OAuthApp {
website String
clientSecretHashed String
redirectUri String
- scopes String
logo String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
diff --git a/apps/web/ui/modals/add-edit-oauth-app-modal.tsx b/apps/web/ui/modals/add-edit-oauth-app-modal.tsx
index 133f6bd5ad..5208a872e0 100644
--- a/apps/web/ui/modals/add-edit-oauth-app-modal.tsx
+++ b/apps/web/ui/modals/add-edit-oauth-app-modal.tsx
@@ -1,22 +1,12 @@
-import {
- ResourceScopeMapping,
- Scope,
- mapScopeToResource,
- permissionsByResource,
- resources,
-} from "@/lib/api/tokens/scopes";
import useWorkspace from "@/lib/swr/use-workspace";
import { OAuthAppProps } from "@/lib/types";
import {
- AnimatedSizeContainer,
BlurImage,
Button,
ButtonProps,
InfoTooltip,
Logo,
Modal,
- RadioGroup,
- RadioGroupItem,
} from "@dub/ui";
import {
Dispatch,
@@ -35,7 +25,6 @@ const newApp: OAuthAppProps = {
website: "",
clientId: "",
redirectUri: "",
- scopes: [],
};
function AddEditAppModal({
@@ -50,11 +39,8 @@ function AddEditAppModal({
onAppCreated?: (App: OAuthAppProps) => void;
}) {
const [saving, setSaving] = useState(false);
+ const { id: workspaceId, logo, slug } = useWorkspace();
const [data, setData] = useState<OAuthAppProps>(app || newApp);
- const { id: workspaceId, logo, slug, betaTester } = useWorkspace();
- const [selectedScopes, setSelectedScopes] = useState<
- ResourceScopeMapping | {}
- >(mapScopeToResource(app?.scopes || []));
// Determine the endpoint
const endpoint = useMemo(() => {
@@ -83,10 +69,7 @@ function AddEditAppModal({
headers: {
"Content-Type": "application/json",
},
- body: JSON.stringify({
- ...data,
- scopes: Object.values(selectedScopes).filter((v) => v),
- }),
+ body: JSON.stringify(data),
});
const result = await response.json();
@@ -103,12 +86,7 @@ function AddEditAppModal({
};
const { name, developer, website, redirectUri } = data;
- const buttonDisabled =
- !name ||
- !developer ||
- !website ||
- !redirectUri ||
- Object.values(selectedScopes).filter((v) => v).length === 0;
+ const buttonDisabled = !name || !developer || !website || !redirectUri;
return (
<>
@@ -219,62 +197,6 @@ function AddEditAppModal({
</div>
</div>
- <div className="flex flex-col gap-2">
- <h2 className="text-sm font-medium text-gray-900">
- Application permissions
- </h2>
- <p className="text-sm text-gray-500">
- These permissions will be presented to the user when adding an app
- to their workspace. Must choose at least one permission.
- </p>
- </div>
-
- <AnimatedSizeContainer height>
- <div className="flex flex-col divide-y text-sm">
- {resources
- .filter((resource) => resource.betaFeature === betaTester)
- .map((resource) => (
- <div
- className="flex items-center justify-between py-4"
- key={resource.key}
- >
- <div className="flex items-center gap-1.5 text-gray-500">
- <p>{resource.name}</p>
- <InfoTooltip content={resource.description} />
- </div>
- <div>
- <RadioGroup
- defaultValue={selectedScopes[resource.key] || ""}
- className="flex gap-4"
- onValueChange={(v: Scope) => {
- setSelectedScopes({
- ...selectedScopes,
- [resource.key]: v,
- });
- }}
- >
- <div className="flex items-center space-x-2">
- <RadioGroupItem value="" />
- <div>None</div>
- </div>
- {permissionsByResource[resource.key]?.map(
- (permission) => (
- <div
- className="flex items-center space-x-2"
- key={permission.scope}
- >
- <RadioGroupItem value={permission.scope} />
- <div>{permission.permission}</div>
- </div>
- ),
- )}
- </RadioGroup>
- </div>
- </div>
- ))}
- </div>
- </AnimatedSizeContainer>
-
<Button
text={app ? "Save changes" : "Create"}
disabled={buttonDisabled}