mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-03 09:34:48 +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(),
|
||||
siteId: z.number(),
|
||||
http: z.boolean(),
|
||||
protocol: z.string(),
|
||||
protocol: z.enum(["tcp", "udp"]),
|
||||
domainId: z.string()
|
||||
})
|
||||
.strict()
|
||||
|
@ -71,7 +71,7 @@ const createRawResourceSchema = z
|
|||
name: z.string().min(1).max(255),
|
||||
siteId: z.number(),
|
||||
http: z.boolean(),
|
||||
protocol: z.string(),
|
||||
protocol: z.enum(["tcp", "udp"]),
|
||||
proxyPort: z.number().int().min(1).max(65535)
|
||||
})
|
||||
.strict()
|
||||
|
@ -85,7 +85,7 @@ const createRawResourceSchema = z
|
|||
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
|
||||
});
|
||||
|
||||
if (req.userOrgRoleId != adminRole[0].roleId) {
|
||||
if (req.user && req.userOrgRoleId != adminRole[0].roleId) {
|
||||
// make sure the user can access the resource
|
||||
await trx.insert(userResources).values({
|
||||
userId: req.user?.userId!,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue