From 59972418b90587d90eb912cde2965bd2f3a93c7e Mon Sep 17 00:00:00 2001 From: buddywinte Date: Thu, 9 Jul 2026 16:40:51 -0500 Subject: [PATCH 1/4] remove form apis --- pages/api/workspace/[id]/forms/helpers.ts | 49 --------------- pages/api/workspace/[id]/forms/index.ts | 73 ----------------------- 2 files changed, 122 deletions(-) delete mode 100644 pages/api/workspace/[id]/forms/helpers.ts delete mode 100644 pages/api/workspace/[id]/forms/index.ts diff --git a/pages/api/workspace/[id]/forms/helpers.ts b/pages/api/workspace/[id]/forms/helpers.ts deleted file mode 100644 index 58cda7c6..00000000 --- a/pages/api/workspace/[id]/forms/helpers.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Orbit Forms - * Licensed under GPL-3.0 (see LICENSE for details) - * - * Helpers to make life easier in the other scripts - * - * @author BuddyWinte - * @since 2.1.10-beta20 - */ - -type Permission = string; -interface Role { - permissions: Permission[]; -} -interface UserWithRoles { - roles: Role[]; -} - -/** - * Checks if a user has a given permission. - * - * Supports: - * - Exact matches: "Form.View" - * - Wildcards: "Form.*" - * - * @returns true if the user has permissions - * @returns false if the user doesn't have permissions - * @readonly - */ -export function hasPerms( - user: UserWithRoles, - permission: string -): boolean { - if (!user?.roles?.length) return false; - for (const role of user.roles) { - if (!role?.permissions?.length) continue; - for (const perm of role.permissions) { - if (perm === permission) return true; - if (perm.endsWith(".*")) { - const prefix = perm.slice(0,-2); - if (permission.startsWith(prefix + ".")) { - return true; - } - } - } - } - - return false; -} \ No newline at end of file diff --git a/pages/api/workspace/[id]/forms/index.ts b/pages/api/workspace/[id]/forms/index.ts deleted file mode 100644 index 3c21c65a..00000000 --- a/pages/api/workspace/[id]/forms/index.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { NextApiRequest, NextApiResponse } from "next"; -import prisma from "@/utils/database"; -type Data = { - success: boolean; - error?: string; - forms?: unknown[]; -}; -import { withAuth, AuthenticatedRequest } from "@/lib/withAuth"; -import { hasPerms } from "./helpers"; - -export default withAuth(handler); - -// GET /api/workspace/[id]/forms - Returns a list of forms a specific user can see -// POST /api/workspace/[id]/forms - Create a new form -export async function handler( - req: AuthenticatedRequest, - res: NextApiResponse, -) { - const user = await prisma.user.findUnique({ - where: { - userid: req.auth.userId, - }, - include: { - roles: { - select: { - id: true, - name: true, - permissions: true, - }, - }, - workspaceMemberships: { - where: { - workspaceGroupId: Number(req.query.id), - }, - include: { - workspace: true, - }, - }, - }, - }); - - if (!user) { - return res.status(404).json({ - success: false, - error: "User not found", - }); - } - - if (req.method === "GET") { - if (!hasPerms(user, "Form.View")) { - return res.status(403).json({ - success: false, - error: "Missing permission: Form.View", - }); - } - - const forms = await prisma.form.findMany({ - where: { - workspaceGroupId: workspaceId, - }, - }); - - return res.status(200).json({ - success: true, - forms, - }); - } - - return res.status(405).json({ - success: false, - error: "Method Not Allowed" - }) -} From f0b72981a981e0b049e0a342f8c1b11723219190 Mon Sep 17 00:00:00 2001 From: buddywinte Date: Thu, 9 Jul 2026 17:03:36 -0500 Subject: [PATCH 2/4] update readme --- README.md | 1 + package-lock.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba89bd99..77130a5a 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ Orbit ships with a comprehensive set of management tools out of the box: | **Documentation** | Host your group's docs natively inside Orbit | | **Policies** | Create and assign policy documents for members to review and sign | | **Sessions** | Schedule and host sessions with minimal overhead | +| **Forms** | Create your own forms, manage there analytics. All in one dashboard. | --- diff --git a/package-lock.json b/package-lock.json index 9ca56f1e..49a51440 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orbit", - "version": "2.1.10beta20", + "version": "2.1.10beta21", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orbit", - "version": "2.1.10beta20", + "version": "2.1.10beta21", "dependencies": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/sortable": "^10.0.0", From 3ac48c57e7e4dbfb1c78725f8c19f591934eb34b Mon Sep 17 00:00:00 2001 From: buddywinte Date: Thu, 9 Jul 2026 17:04:32 -0500 Subject: [PATCH 3/4] update readme x2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 77130a5a..1ebcebb4 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Orbit ships with a comprehensive set of management tools out of the box: | **Documentation** | Host your group's docs natively inside Orbit | | **Policies** | Create and assign policy documents for members to review and sign | | **Sessions** | Schedule and host sessions with minimal overhead | -| **Forms** | Create your own forms, manage there analytics. All in one dashboard. | +| **Forms** | Build custom forms, manage submissions, and track analytics from a single dashboard. | --- From 4bb4a1d037ad155417ea87e9b663b8d68a3e3a31 Mon Sep 17 00:00:00 2001 From: buddywinte Date: Thu, 9 Jul 2026 17:05:33 -0500 Subject: [PATCH 4/4] re-enable the toggle --- components/settings/general/form.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/components/settings/general/form.tsx b/components/settings/general/form.tsx index b6246acf..e94cf17c 100644 --- a/components/settings/general/form.tsx +++ b/components/settings/general/form.tsx @@ -26,14 +26,8 @@ const Forms: FC = (props) => {

Create, customize, and manage workspace forms for collecting structured data, submissions, and user input across your workspace (Coming Soon)

- {/**/}