Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { requireUser, t } from "../../trpc";
export const getOrganizationMemberList = t.procedure
.use(requireUser)
.input(z.string())
.query(async ({ input: orgId }) => {
.query(async ({ ctx }) => {
try {
return await authProvider.getOrganizationMemberList(orgId);
return await authProvider.getOrganizationMemberList(ctx.tenant.id);
} catch (error) {
console.error("Error retrieving organization member list:", error);
throw new TRPCError({
Expand Down
28 changes: 0 additions & 28 deletions apps/dashboard/lib/trpc/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,6 @@ export const requireSelf = t.middleware(({ next, ctx, rawInput: userId }) => {
return next();
});

export const requireOrgAccess = t.middleware(async ({ next, ctx, rawInput: orgId }) => {
if (!orgId) {
throw new TRPCError({
code: "BAD_REQUEST",
message: "Organization ID is required",
});
}
try {
const memberships = await auth.listMemberships(ctx.user!.id);
const hasAccess = memberships.data.some((m) => m.organization.id === orgId);

if (!hasAccess) {
throw new TRPCError({
code: "FORBIDDEN",
message: "You do not have access to this organization",
});
}

return next();
} catch (error) {
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
message: "Failed to verify organization access",
cause: error,
});
}
});

export const requireOrgAdmin = t.middleware(async ({ next, ctx, rawInput }) => {
let orgId: string | undefined;

Expand Down
48 changes: 11 additions & 37 deletions apps/docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
},
{
"group": "Identities",
"pages": [
"quickstart/identities/shared-ratelimits"
]
"pages": ["quickstart/identities/shared-ratelimits"]
}
]
},
Expand All @@ -75,10 +73,7 @@
{
"group": "Identities",
"icon": "fingerprint",
"pages": [
"concepts/identities/overview",
"concepts/identities/ratelimits"
]
"pages": ["concepts/identities/overview", "concepts/identities/ratelimits"]
}
]
},
Expand Down Expand Up @@ -130,34 +125,23 @@
},
{
"group": "Audit logs",
"pages": [
"audit-log/introduction",
"audit-log/types"
]
"pages": ["audit-log/introduction", "audit-log/types"]
},
{
"group": "Analytics",
"pages": [
"analytics/overview",
"analytics/quickstarts"
]
"pages": ["analytics/overview", "analytics/quickstarts"]
}
]
},
{
"group": "Integrations",
"icon": "bolt",
"pages": [
"integrations/vercel"
]
"pages": ["integrations/vercel"]
},
{
"group": "Migrations",
"icon": "plane-arrival",
"pages": [
"migrations/introduction",
"migrations/keys"
]
"pages": ["migrations/introduction", "migrations/keys"]
}
]
},
Expand Down Expand Up @@ -302,15 +286,11 @@
},
{
"group": "Analytics",
"pages": [
"api-reference/analytics/get_verifications"
]
"pages": ["api-reference/analytics/get_verifications"]
},
{
"group": "Migrations",
"pages": [
"api-reference/migrations/create-keys"
]
"pages": ["api-reference/migrations/create-keys"]
}
]
}
Expand Down Expand Up @@ -386,9 +366,7 @@
"libraries/ts/cache/overview",
{
"group": "unkey-go",
"pages": [
"libraries/go/overview"
]
"pages": ["libraries/go/overview"]
},
{
"group": "unkey.py",
Expand Down Expand Up @@ -426,15 +404,11 @@
},
{
"group": "Nuxt",
"pages": [
"libraries/nuxt/overview"
]
"pages": ["libraries/nuxt/overview"]
},
{
"group": "Rust",
"pages": [
"libraries/rs/overview"
]
"pages": ["libraries/rs/overview"]
},
{
"group": "Springboot",
Expand Down
Loading