feature: add ability to join org as super admin

This commit is contained in:
Scott Wilson
2025-09-02 13:33:28 -07:00
parent 4d6e12d6b2
commit 435bcd03d3
4 changed files with 154 additions and 12 deletions
@@ -896,4 +896,34 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => {
return { organizationMembership };
}
});
server.route({
method: "POST",
url: "/organization-management/organizations/:organizationId/access",
config: {
rateLimit: writeLimit
},
schema: {
params: z.object({
organizationId: z.string()
}),
response: {
200: z.object({
organizationMembership: OrgMembershipsSchema
})
}
},
onRequest: (req, res, done) => {
verifyAuth([AuthMode.JWT])(req, res, () => {
verifySuperAdmin(req, res, done);
});
},
handler: async (req) => {
const organizationMembership = await server.services.superAdmin.joinOrganization(
req.params.organizationId,
req.permission
);
return { organizationMembership };
}
});
};