Skip to content

Commit b2a001f

Browse files
committed
update paths
1 parent 7130914 commit b2a001f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/api/routes/iam.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const iamRoutes: FastifyPluginAsync = async (fastify, _options) => {
4444
Body: undefined;
4545
Querystring: { groupId: string };
4646
}>(
47-
"/groupRoles/:groupId",
47+
"/groups/:groupId/roles",
4848
{
4949
schema: {
5050
querystring: {
@@ -90,7 +90,7 @@ const iamRoutes: FastifyPluginAsync = async (fastify, _options) => {
9090
Body: GroupMappingCreatePostRequest;
9191
Querystring: { groupId: string };
9292
}>(
93-
"/groupRoles/:groupId",
93+
"/groups/:groupId/roles",
9494
{
9595
schema: {
9696
querystring: {
@@ -140,7 +140,7 @@ const iamRoutes: FastifyPluginAsync = async (fastify, _options) => {
140140
reply.send({ message: "OK" });
141141
request.log.info(
142142
{ type: "audit", actor: request.username, target: groupId },
143-
`set group ID roles to ${request.body.roles.toString()}`,
143+
`set target roles to ${request.body.roles.toString()}`,
144144
);
145145
},
146146
);

src/common/types/iam.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ export const invitePostRequestSchema = z.object({
2222
export type InviteUserPostRequest = z.infer<typeof invitePostRequestSchema>;
2323

2424
export const groupMappingCreatePostSchema = z.object({
25-
roles: z
26-
.array(z.nativeEnum(AppRoles))
27-
.min(1)
28-
.refine((items) => new Set(items).size === items.length, {
29-
message: "All roles must be unique, no duplicate values allowed",
30-
}),
25+
roles: z.union([
26+
z.array(z.nativeEnum(AppRoles))
27+
.min(1)
28+
.refine((items) => new Set(items).size === items.length, {
29+
message: "All roles must be unique, no duplicate values allowed",
30+
}),
31+
z.tuple([z.literal("all")]),
32+
]),
3133
});
3234

35+
3336
export type GroupMappingCreatePostRequest = z.infer<
3437
typeof groupMappingCreatePostSchema
3538
>;

0 commit comments

Comments
 (0)