update policy access control

This commit is contained in:
Fred KISSIE
2026-03-02 19:26:51 +01:00
parent e7ab9b3f37
commit 4c69b7a64e
2 changed files with 150 additions and 19 deletions

View File

@@ -27,7 +27,7 @@ const createResourcePolicyParamsSchema = z.strictObject({
const createResourcePolicyBodySchema = z.strictObject({
name: z.string().min(1).max(255),
sso: z.boolean(),
skipToIdpId: z.string().optional(),
skipToIdpId: z.int().positive().optional(),
roleIds: z
.array(z.string().transform(Number).pipe(z.int().positive()))
.optional()
@@ -150,7 +150,9 @@ export async function createResourcePolicy(
.select()
.from(users)
.innerJoin(userOrgs, eq(userOrgs.userId, users.userId))
.where(and(inArray(users.userId, userIds)));
.where(
and(eq(userOrgs.orgId, orgId), inArray(users.userId, userIds))
);
const niceId = await getUniqueResourcePolicyName(orgId);