mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-16 23:41:11 +02:00
fix bug preventing creating raw resources with api key closes #920
This commit is contained in:
parent
b56ba3ee23
commit
c043912f94
1 changed files with 4 additions and 4 deletions
|
@ -39,7 +39,7 @@ const createHttpResourceSchema = z
|
||||||
isBaseDomain: z.boolean().optional(),
|
isBaseDomain: z.boolean().optional(),
|
||||||
siteId: z.number(),
|
siteId: z.number(),
|
||||||
http: z.boolean(),
|
http: z.boolean(),
|
||||||
protocol: z.string(),
|
protocol: z.enum(["tcp", "udp"]),
|
||||||
domainId: z.string()
|
domainId: z.string()
|
||||||
})
|
})
|
||||||
.strict()
|
.strict()
|
||||||
|
@ -71,7 +71,7 @@ const createRawResourceSchema = z
|
||||||
name: z.string().min(1).max(255),
|
name: z.string().min(1).max(255),
|
||||||
siteId: z.number(),
|
siteId: z.number(),
|
||||||
http: z.boolean(),
|
http: z.boolean(),
|
||||||
protocol: z.string(),
|
protocol: z.enum(["tcp", "udp"]),
|
||||||
proxyPort: z.number().int().min(1).max(65535)
|
proxyPort: z.number().int().min(1).max(65535)
|
||||||
})
|
})
|
||||||
.strict()
|
.strict()
|
||||||
|
@ -85,7 +85,7 @@ const createRawResourceSchema = z
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: "Proxy port cannot be set"
|
message: "Raw resources are not allowed"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ async function createRawResource(
|
||||||
resourceId: newResource[0].resourceId
|
resourceId: newResource[0].resourceId
|
||||||
});
|
});
|
||||||
|
|
||||||
if (req.userOrgRoleId != adminRole[0].roleId) {
|
if (req.user && req.userOrgRoleId != adminRole[0].roleId) {
|
||||||
// make sure the user can access the resource
|
// make sure the user can access the resource
|
||||||
await trx.insert(userResources).values({
|
await trx.insert(userResources).values({
|
||||||
userId: req.user?.userId!,
|
userId: req.user?.userId!,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue