mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-03 09:16:40 +00:00
Compare commits
18 Commits
1.16.2-s.0
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed95f10fcc | ||
|
|
64bae5b142 | ||
|
|
19f9dda490 | ||
|
|
cdf79edb00 | ||
|
|
280cbb6e22 | ||
|
|
c20babcb53 | ||
|
|
768eebe2cd | ||
|
|
44e3eedffa | ||
|
|
bb189874cb | ||
|
|
34dadd0e16 | ||
|
|
87b5cd9988 | ||
|
|
6a537a23e8 | ||
|
|
e63a6e9b77 | ||
|
|
7ce589c4f2 | ||
|
|
f36cf06e26 | ||
|
|
375211f184 | ||
|
|
81c1a1da9c | ||
|
|
52f26396ac |
@@ -1102,6 +1102,12 @@
|
|||||||
"actionGetUser": "Get User",
|
"actionGetUser": "Get User",
|
||||||
"actionGetOrgUser": "Get Organization User",
|
"actionGetOrgUser": "Get Organization User",
|
||||||
"actionListOrgDomains": "List Organization Domains",
|
"actionListOrgDomains": "List Organization Domains",
|
||||||
|
"actionGetDomain": "Get Domain",
|
||||||
|
"actionCreateOrgDomain": "Create Domain",
|
||||||
|
"actionUpdateOrgDomain": "Update Domain",
|
||||||
|
"actionDeleteOrgDomain": "Delete Domain",
|
||||||
|
"actionGetDNSRecords": "Get DNS Records",
|
||||||
|
"actionRestartOrgDomain": "Restart Domain",
|
||||||
"actionCreateSite": "Create Site",
|
"actionCreateSite": "Create Site",
|
||||||
"actionDeleteSite": "Delete Site",
|
"actionDeleteSite": "Delete Site",
|
||||||
"actionGetSite": "Get Site",
|
"actionGetSite": "Get Site",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import fs from "fs";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import { APP_PATH } from "./lib/consts";
|
import { APP_PATH } from "./lib/consts";
|
||||||
import yaml from "js-yaml";
|
import yaml from "js-yaml";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
const dev = process.env.ENVIRONMENT !== "prod";
|
const dev = process.env.ENVIRONMENT !== "prod";
|
||||||
const externalPort = config.getRawConfig().server.integration_port;
|
const externalPort = config.getRawConfig().server.integration_port;
|
||||||
@@ -38,12 +39,24 @@ export function createIntegrationApiServer() {
|
|||||||
apiServer.use(cookieParser());
|
apiServer.use(cookieParser());
|
||||||
apiServer.use(express.json());
|
apiServer.use(express.json());
|
||||||
|
|
||||||
|
const openApiDocumentation = getOpenApiDocumentation();
|
||||||
|
|
||||||
apiServer.use(
|
apiServer.use(
|
||||||
"/v1/docs",
|
"/v1/docs",
|
||||||
swaggerUi.serve,
|
swaggerUi.serve,
|
||||||
swaggerUi.setup(getOpenApiDocumentation())
|
swaggerUi.setup(openApiDocumentation)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Unauthenticated OpenAPI spec endpoints
|
||||||
|
apiServer.get("/v1/openapi.json", (_req, res) => {
|
||||||
|
res.json(openApiDocumentation);
|
||||||
|
});
|
||||||
|
|
||||||
|
apiServer.get("/v1/openapi.yaml", (_req, res) => {
|
||||||
|
const yamlOutput = yaml.dump(openApiDocumentation);
|
||||||
|
res.type("application/yaml").send(yamlOutput);
|
||||||
|
});
|
||||||
|
|
||||||
// API routes
|
// API routes
|
||||||
const prefix = `/v1`;
|
const prefix = `/v1`;
|
||||||
apiServer.use(logIncomingMiddleware);
|
apiServer.use(logIncomingMiddleware);
|
||||||
@@ -75,16 +88,6 @@ function getOpenApiDocumentation() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const def of registry.definitions) {
|
|
||||||
if (def.type === "route") {
|
|
||||||
def.route.security = [
|
|
||||||
{
|
|
||||||
[bearerAuth.name]: []
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/",
|
path: "/",
|
||||||
@@ -94,6 +97,74 @@ function getOpenApiDocumentation() {
|
|||||||
responses: {}
|
responses: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registry.registerPath({
|
||||||
|
method: "get",
|
||||||
|
path: "/openapi.json",
|
||||||
|
description: "Get OpenAPI specification as JSON",
|
||||||
|
tags: [],
|
||||||
|
request: {},
|
||||||
|
responses: {
|
||||||
|
"200": {
|
||||||
|
description: "OpenAPI specification as JSON",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: {
|
||||||
|
type: "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registry.registerPath({
|
||||||
|
method: "get",
|
||||||
|
path: "/openapi.yaml",
|
||||||
|
description: "Get OpenAPI specification as YAML",
|
||||||
|
tags: [],
|
||||||
|
request: {},
|
||||||
|
responses: {
|
||||||
|
"200": {
|
||||||
|
description: "OpenAPI specification as YAML",
|
||||||
|
content: {
|
||||||
|
"application/yaml": {
|
||||||
|
schema: {
|
||||||
|
type: "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const def of registry.definitions) {
|
||||||
|
if (def.type === "route") {
|
||||||
|
def.route.security = [
|
||||||
|
{
|
||||||
|
[bearerAuth.name]: []
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// Ensure every route has a generic JSON response schema so Swagger UI can render responses
|
||||||
|
const existingResponses = def.route.responses;
|
||||||
|
const hasExistingResponses =
|
||||||
|
existingResponses && Object.keys(existingResponses).length > 0;
|
||||||
|
|
||||||
|
if (!hasExistingResponses) {
|
||||||
|
def.route.responses = {
|
||||||
|
"*": {
|
||||||
|
description: "",
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: z.object({})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const generator = new OpenApiGeneratorV3(registry.definitions);
|
const generator = new OpenApiGeneratorV3(registry.definitions);
|
||||||
|
|
||||||
const generated = generator.generateDocument({
|
const generated = generator.generateDocument({
|
||||||
|
|||||||
@@ -477,7 +477,10 @@ export async function getTraefikConfig(
|
|||||||
|
|
||||||
// TODO: HOW TO HANDLE ^^^^^^ BETTER
|
// TODO: HOW TO HANDLE ^^^^^^ BETTER
|
||||||
const anySitesOnline = targets.some(
|
const anySitesOnline = targets.some(
|
||||||
(target) => target.site.online
|
(target) =>
|
||||||
|
target.site.online ||
|
||||||
|
target.site.type === "local" ||
|
||||||
|
target.site.type === "wireguard"
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -605,7 +608,10 @@ export async function getTraefikConfig(
|
|||||||
servers: (() => {
|
servers: (() => {
|
||||||
// Check if any sites are online
|
// Check if any sites are online
|
||||||
const anySitesOnline = targets.some(
|
const anySitesOnline = targets.some(
|
||||||
(target) => target.site.online
|
(target) =>
|
||||||
|
target.site.online ||
|
||||||
|
target.site.type === "local" ||
|
||||||
|
target.site.type === "wireguard"
|
||||||
);
|
);
|
||||||
|
|
||||||
return targets
|
return targets
|
||||||
|
|||||||
@@ -14,3 +14,4 @@ export * from "./verifyApiKeyApiKeyAccess";
|
|||||||
export * from "./verifyApiKeyClientAccess";
|
export * from "./verifyApiKeyClientAccess";
|
||||||
export * from "./verifyApiKeySiteResourceAccess";
|
export * from "./verifyApiKeySiteResourceAccess";
|
||||||
export * from "./verifyApiKeyIdpAccess";
|
export * from "./verifyApiKeyIdpAccess";
|
||||||
|
export * from "./verifyApiKeyDomainAccess";
|
||||||
|
|||||||
90
server/middlewares/integration/verifyApiKeyDomainAccess.ts
Normal file
90
server/middlewares/integration/verifyApiKeyDomainAccess.ts
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
import { Request, Response, NextFunction } from "express";
|
||||||
|
import { db, domains, orgDomains, apiKeyOrg } from "@server/db";
|
||||||
|
import { and, eq } from "drizzle-orm";
|
||||||
|
import createHttpError from "http-errors";
|
||||||
|
import HttpCode from "@server/types/HttpCode";
|
||||||
|
|
||||||
|
export async function verifyApiKeyDomainAccess(
|
||||||
|
req: Request,
|
||||||
|
res: Response,
|
||||||
|
next: NextFunction
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
const apiKey = req.apiKey;
|
||||||
|
const domainId =
|
||||||
|
req.params.domainId || req.body.domainId || req.query.domainId;
|
||||||
|
const orgId = req.params.orgId;
|
||||||
|
|
||||||
|
if (!apiKey) {
|
||||||
|
return next(
|
||||||
|
createHttpError(HttpCode.UNAUTHORIZED, "Key not authenticated")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!domainId) {
|
||||||
|
return next(
|
||||||
|
createHttpError(HttpCode.BAD_REQUEST, "Invalid domain ID")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (apiKey.isRoot) {
|
||||||
|
// Root keys can access any domain in any org
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify domain exists and belongs to the organization
|
||||||
|
const [domain] = await db
|
||||||
|
.select()
|
||||||
|
.from(domains)
|
||||||
|
.innerJoin(orgDomains, eq(orgDomains.domainId, domains.domainId))
|
||||||
|
.where(
|
||||||
|
and(
|
||||||
|
eq(orgDomains.domainId, domainId),
|
||||||
|
eq(orgDomains.orgId, orgId)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.limit(1);
|
||||||
|
|
||||||
|
if (!domain) {
|
||||||
|
return next(
|
||||||
|
createHttpError(
|
||||||
|
HttpCode.NOT_FOUND,
|
||||||
|
`Domain with ID ${domainId} not found in organization ${orgId}`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify the API key has access to this organization
|
||||||
|
if (!req.apiKeyOrg) {
|
||||||
|
const apiKeyOrgRes = await db
|
||||||
|
.select()
|
||||||
|
.from(apiKeyOrg)
|
||||||
|
.where(
|
||||||
|
and(
|
||||||
|
eq(apiKeyOrg.apiKeyId, apiKey.apiKeyId),
|
||||||
|
eq(apiKeyOrg.orgId, orgId)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.limit(1);
|
||||||
|
req.apiKeyOrg = apiKeyOrgRes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!req.apiKeyOrg) {
|
||||||
|
return next(
|
||||||
|
createHttpError(
|
||||||
|
HttpCode.FORBIDDEN,
|
||||||
|
"Key does not have access to this organization"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return next();
|
||||||
|
} catch (error) {
|
||||||
|
return next(
|
||||||
|
createHttpError(
|
||||||
|
HttpCode.INTERNAL_SERVER_ERROR,
|
||||||
|
"Error verifying domain access"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,17 +5,20 @@ export const registry = new OpenAPIRegistry();
|
|||||||
export enum OpenAPITags {
|
export enum OpenAPITags {
|
||||||
Site = "Site",
|
Site = "Site",
|
||||||
Org = "Organization",
|
Org = "Organization",
|
||||||
Resource = "Resource",
|
PublicResource = "Public Resource",
|
||||||
|
PrivateResource = "Private Resource",
|
||||||
Role = "Role",
|
Role = "Role",
|
||||||
User = "User",
|
User = "User",
|
||||||
Invitation = "Invitation",
|
Invitation = "User Invitation",
|
||||||
Target = "Target",
|
Target = "Resource Target",
|
||||||
Rule = "Rule",
|
Rule = "Rule",
|
||||||
AccessToken = "Access Token",
|
AccessToken = "Access Token",
|
||||||
Idp = "Identity Provider",
|
GlobalIdp = "Identity Provider (Global)",
|
||||||
|
OrgIdp = "Identity Provider (Organization Only)",
|
||||||
Client = "Client",
|
Client = "Client",
|
||||||
ApiKey = "API Key",
|
ApiKey = "API Key",
|
||||||
Domain = "Domain",
|
Domain = "Domain",
|
||||||
Blueprint = "Blueprint",
|
Blueprint = "Blueprint",
|
||||||
Ssh = "SSH"
|
Ssh = "SSH",
|
||||||
|
Logs = "Logs"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -665,7 +665,10 @@ export async function getTraefikConfig(
|
|||||||
|
|
||||||
// TODO: HOW TO HANDLE ^^^^^^ BETTER
|
// TODO: HOW TO HANDLE ^^^^^^ BETTER
|
||||||
const anySitesOnline = targets.some(
|
const anySitesOnline = targets.some(
|
||||||
(target) => target.site.online
|
(target) =>
|
||||||
|
target.site.online ||
|
||||||
|
target.site.type === "local" ||
|
||||||
|
target.site.type === "wireguard"
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -793,7 +796,10 @@ export async function getTraefikConfig(
|
|||||||
servers: (() => {
|
servers: (() => {
|
||||||
// Check if any sites are online
|
// Check if any sites are online
|
||||||
const anySitesOnline = targets.some(
|
const anySitesOnline = targets.some(
|
||||||
(target) => target.site.online
|
(target) =>
|
||||||
|
target.site.online ||
|
||||||
|
target.site.type === "local" ||
|
||||||
|
target.site.type === "wireguard"
|
||||||
);
|
);
|
||||||
|
|
||||||
return targets
|
return targets
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/logs/access/export",
|
path: "/org/{orgId}/logs/access/export",
|
||||||
description: "Export the access audit log for an organization as CSV",
|
description: "Export the access audit log for an organization as CSV",
|
||||||
tags: [OpenAPITags.Org],
|
tags: [OpenAPITags.Logs],
|
||||||
request: {
|
request: {
|
||||||
query: queryAccessAuditLogsQuery,
|
query: queryAccessAuditLogsQuery,
|
||||||
params: queryAccessAuditLogsParams
|
params: queryAccessAuditLogsParams
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/logs/action/export",
|
path: "/org/{orgId}/logs/action/export",
|
||||||
description: "Export the action audit log for an organization as CSV",
|
description: "Export the action audit log for an organization as CSV",
|
||||||
tags: [OpenAPITags.Org],
|
tags: [OpenAPITags.Logs],
|
||||||
request: {
|
request: {
|
||||||
query: queryActionAuditLogsQuery,
|
query: queryActionAuditLogsQuery,
|
||||||
params: queryActionAuditLogsParams
|
params: queryActionAuditLogsParams
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/logs/access",
|
path: "/org/{orgId}/logs/access",
|
||||||
description: "Query the access audit log for an organization",
|
description: "Query the access audit log for an organization",
|
||||||
tags: [OpenAPITags.Org],
|
tags: [OpenAPITags.Logs],
|
||||||
request: {
|
request: {
|
||||||
query: queryAccessAuditLogsQuery,
|
query: queryAccessAuditLogsQuery,
|
||||||
params: queryAccessAuditLogsParams
|
params: queryAccessAuditLogsParams
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/logs/action",
|
path: "/org/{orgId}/logs/action",
|
||||||
description: "Query the action audit log for an organization",
|
description: "Query the action audit log for an organization",
|
||||||
tags: [OpenAPITags.Org],
|
tags: [OpenAPITags.Logs],
|
||||||
request: {
|
request: {
|
||||||
query: queryActionAuditLogsQuery,
|
query: queryActionAuditLogsQuery,
|
||||||
params: queryActionAuditLogsParams
|
params: queryActionAuditLogsParams
|
||||||
|
|||||||
@@ -31,16 +31,16 @@ const getOrgSchema = z.strictObject({
|
|||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
});
|
});
|
||||||
|
|
||||||
registry.registerPath({
|
// registry.registerPath({
|
||||||
method: "get",
|
// method: "get",
|
||||||
path: "/org/{orgId}/billing/usage",
|
// path: "/org/{orgId}/billing/usage",
|
||||||
description: "Get an organization's billing usage",
|
// description: "Get an organization's billing usage",
|
||||||
tags: [OpenAPITags.Org],
|
// tags: [OpenAPITags.Org],
|
||||||
request: {
|
// request: {
|
||||||
params: getOrgSchema
|
// params: getOrgSchema
|
||||||
},
|
// },
|
||||||
responses: {}
|
// responses: {}
|
||||||
});
|
// });
|
||||||
|
|
||||||
export async function getOrgUsage(
|
export async function getOrgUsage(
|
||||||
req: Request,
|
req: Request,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/org/{orgId}/idp/oidc",
|
path: "/org/{orgId}/idp/oidc",
|
||||||
description: "Create an OIDC IdP for a specific organization.",
|
description: "Create an OIDC IdP for a specific organization.",
|
||||||
tags: [OpenAPITags.Idp, OpenAPITags.Org],
|
tags: [OpenAPITags.OrgIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ registry.registerPath({
|
|||||||
method: "delete",
|
method: "delete",
|
||||||
path: "/org/{orgId}/idp/{idpId}",
|
path: "/org/{orgId}/idp/{idpId}",
|
||||||
description: "Delete IDP for a specific organization.",
|
description: "Delete IDP for a specific organization.",
|
||||||
tags: [OpenAPITags.Idp, OpenAPITags.Org],
|
tags: [OpenAPITags.OrgIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ async function query(idpId: number, orgId: string) {
|
|||||||
|
|
||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/:orgId/idp/:idpId",
|
path: "/org/{orgId}/idp/{idpId}",
|
||||||
description: "Get an IDP by its IDP ID for a specific organization.",
|
description: "Get an IDP by its IDP ID for a specific organization.",
|
||||||
tags: [OpenAPITags.Idp, OpenAPITags.Org],
|
tags: [OpenAPITags.OrgIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/idp",
|
path: "/org/{orgId}/idp",
|
||||||
description: "List all IDP for a specific organization.",
|
description: "List all IDP for a specific organization.",
|
||||||
tags: [OpenAPITags.Idp, OpenAPITags.Org],
|
tags: [OpenAPITags.OrgIdp],
|
||||||
request: {
|
request: {
|
||||||
query: querySchema,
|
query: querySchema,
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/org/{orgId}/idp/{idpId}/oidc",
|
path: "/org/{orgId}/idp/{idpId}/oidc",
|
||||||
description: "Update an OIDC IdP for a specific organization.",
|
description: "Update an OIDC IdP for a specific organization.",
|
||||||
tags: [OpenAPITags.Idp, OpenAPITags.Org],
|
tags: [OpenAPITags.OrgIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/maintenance/info",
|
path: "/maintenance/info",
|
||||||
description: "Get maintenance information for a resource by domain.",
|
description: "Get maintenance information for a resource by domain.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
query: z.object({
|
query: z.object({
|
||||||
fullDomain: z.string()
|
fullDomain: z.string()
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/resource/{resourceId}/access-token",
|
path: "/resource/{resourceId}/access-token",
|
||||||
description: "Generate a new access token for a resource.",
|
description: "Generate a new access token for a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.AccessToken],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.AccessToken],
|
||||||
request: {
|
request: {
|
||||||
params: generateAccssTokenParamsSchema,
|
params: generateAccssTokenParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/access-tokens",
|
path: "/org/{orgId}/access-tokens",
|
||||||
description: "List all access tokens in an organization.",
|
description: "List all access tokens in an organization.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.AccessToken],
|
tags: [OpenAPITags.AccessToken],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
@@ -135,8 +135,8 @@ registry.registerPath({
|
|||||||
registry.registerPath({
|
registry.registerPath({
|
||||||
method: "get",
|
method: "get",
|
||||||
path: "/resource/{resourceId}/access-tokens",
|
path: "/resource/{resourceId}/access-tokens",
|
||||||
description: "List all access tokens in an organization.",
|
description: "List all access tokens for a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.AccessToken],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.AccessToken],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
resourceId: z.number()
|
resourceId: z.number()
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/org/{orgId}/api-key",
|
path: "/org/{orgId}/api-key",
|
||||||
description: "Create a new API key scoped to the organization.",
|
description: "Create a new API key scoped to the organization.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.ApiKey],
|
tags: [OpenAPITags.ApiKey],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ registry.registerPath({
|
|||||||
method: "delete",
|
method: "delete",
|
||||||
path: "/org/{orgId}/api-key/{apiKeyId}",
|
path: "/org/{orgId}/api-key/{apiKeyId}",
|
||||||
description: "Delete an API key.",
|
description: "Delete an API key.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.ApiKey],
|
tags: [OpenAPITags.ApiKey],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/api-key/{apiKeyId}/actions",
|
path: "/org/{orgId}/api-key/{apiKeyId}/actions",
|
||||||
description: "List all actions set for an API key.",
|
description: "List all actions set for an API key.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.ApiKey],
|
tags: [OpenAPITags.ApiKey],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
query: querySchema
|
query: querySchema
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/api-keys",
|
path: "/org/{orgId}/api-keys",
|
||||||
description: "List all API keys for an organization",
|
description: "List all API keys for an organization",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.ApiKey],
|
tags: [OpenAPITags.ApiKey],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
query: querySchema
|
query: querySchema
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ registry.registerPath({
|
|||||||
path: "/org/{orgId}/api-key/{apiKeyId}/actions",
|
path: "/org/{orgId}/api-key/{apiKeyId}/actions",
|
||||||
description:
|
description:
|
||||||
"Set actions for an API key. This will replace any existing actions.",
|
"Set actions for an API key. This will replace any existing actions.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.ApiKey],
|
tags: [OpenAPITags.ApiKey],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/logs/request",
|
path: "/org/{orgId}/logs/request",
|
||||||
description: "Query the request audit log for an organization",
|
description: "Query the request audit log for an organization",
|
||||||
tags: [OpenAPITags.Org],
|
tags: [OpenAPITags.Logs],
|
||||||
request: {
|
request: {
|
||||||
query: queryAccessAuditLogsQuery.omit({
|
query: queryAccessAuditLogsQuery.omit({
|
||||||
limit: true,
|
limit: true,
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/logs/analytics",
|
path: "/org/{orgId}/logs/analytics",
|
||||||
description: "Query the request audit analytics for an organization",
|
description: "Query the request audit analytics for an organization",
|
||||||
tags: [OpenAPITags.Org],
|
tags: [OpenAPITags.Logs],
|
||||||
request: {
|
request: {
|
||||||
query: queryAccessAuditLogsQuery,
|
query: queryAccessAuditLogsQuery,
|
||||||
params: queryRequestAuditLogsParams
|
params: queryRequestAuditLogsParams
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/logs/request",
|
path: "/org/{orgId}/logs/request",
|
||||||
description: "Query the request audit log for an organization",
|
description: "Query the request audit log for an organization",
|
||||||
tags: [OpenAPITags.Org],
|
tags: [OpenAPITags.Logs],
|
||||||
request: {
|
request: {
|
||||||
query: queryAccessAuditLogsQuery,
|
query: queryAccessAuditLogsQuery,
|
||||||
params: queryRequestAuditLogsParams
|
params: queryRequestAuditLogsParams
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/org/{orgId}/blueprint",
|
path: "/org/{orgId}/blueprint",
|
||||||
description: "Apply a base64 encoded JSON blueprint to an organization",
|
description: "Apply a base64 encoded JSON blueprint to an organization",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Blueprint],
|
tags: [OpenAPITags.Blueprint],
|
||||||
request: {
|
request: {
|
||||||
params: applyBlueprintParamsSchema,
|
params: applyBlueprintParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/org/{orgId}/blueprint",
|
path: "/org/{orgId}/blueprint",
|
||||||
description: "Create and apply a YAML blueprint to an organization",
|
description: "Create and apply a YAML blueprint to an organization",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Blueprint],
|
tags: [OpenAPITags.Blueprint],
|
||||||
request: {
|
request: {
|
||||||
params: applyBlueprintParamsSchema,
|
params: applyBlueprintParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/blueprint/{blueprintId}",
|
path: "/org/{orgId}/blueprint/{blueprintId}",
|
||||||
description: "Get a blueprint by its blueprint ID.",
|
description: "Get a blueprint by its blueprint ID.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Blueprint],
|
tags: [OpenAPITags.Blueprint],
|
||||||
request: {
|
request: {
|
||||||
params: getBlueprintSchema
|
params: getBlueprintSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/blueprints",
|
path: "/org/{orgId}/blueprints",
|
||||||
description: "List all blueprints for a organization.",
|
description: "List all blueprints for a organization.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Blueprint],
|
tags: [OpenAPITags.Blueprint],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/org/{orgId}/client",
|
path: "/org/{orgId}/client",
|
||||||
description: "Create a new client for an organization.",
|
description: "Create a new client for an organization.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.Client],
|
||||||
request: {
|
request: {
|
||||||
params: createClientParamsSchema,
|
params: createClientParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ registry.registerPath({
|
|||||||
path: "/org/{orgId}/user/{userId}/client",
|
path: "/org/{orgId}/user/{userId}/client",
|
||||||
description:
|
description:
|
||||||
"Create a new client for a user and associate it with an existing olm.",
|
"Create a new client for a user and associate it with an existing olm.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org, OpenAPITags.User],
|
tags: [OpenAPITags.Client],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ registry.registerPath({
|
|||||||
path: "/org/{orgId}/client/{niceId}",
|
path: "/org/{orgId}/client/{niceId}",
|
||||||
description:
|
description:
|
||||||
"Get a client by orgId and niceId. NiceId is a readable ID for the site and unique on a per org basis.",
|
"Get a client by orgId and niceId. NiceId is a readable ID for the site and unique on a per org basis.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Site],
|
tags: [OpenAPITags.Site],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
orgId: z.string(),
|
orgId: z.string(),
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/clients",
|
path: "/org/{orgId}/clients",
|
||||||
description: "List all clients for an organization.",
|
description: "List all clients for an organization.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.Client],
|
||||||
request: {
|
request: {
|
||||||
query: listClientsSchema,
|
query: listClientsSchema,
|
||||||
params: listClientsParamsSchema
|
params: listClientsParamsSchema
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/user-devices",
|
path: "/org/{orgId}/user-devices",
|
||||||
description: "List all user devices for an organization.",
|
description: "List all user devices for an organization.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.Client],
|
||||||
request: {
|
request: {
|
||||||
query: listUserDevicesSchema,
|
query: listUserDevicesSchema,
|
||||||
params: listUserDevicesParamsSchema
|
params: listUserDevicesParamsSchema
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/pick-client-defaults",
|
path: "/org/{orgId}/pick-client-defaults",
|
||||||
description: "Return pre-requisite data for creating a client.",
|
description: "Return pre-requisite data for creating a client.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Site],
|
tags: [OpenAPITags.Client],
|
||||||
request: {
|
request: {
|
||||||
params: pickClientDefaultsSchema
|
params: pickClientDefaultsSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/domains",
|
path: "/org/{orgId}/domains",
|
||||||
description: "List all domains for a organization.",
|
description: "List all domains for a organization.",
|
||||||
tags: [OpenAPITags.Org],
|
tags: [OpenAPITags.Domain],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/idp/{idpId}/org/{orgId}",
|
path: "/idp/{idpId}/org/{orgId}",
|
||||||
description: "Create an IDP policy for an existing IDP on an organization.",
|
description: "Create an IDP policy for an existing IDP on an organization.",
|
||||||
tags: [OpenAPITags.Idp],
|
tags: [OpenAPITags.GlobalIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/idp/oidc",
|
path: "/idp/oidc",
|
||||||
description: "Create an OIDC IdP.",
|
description: "Create an OIDC IdP.",
|
||||||
tags: [OpenAPITags.Idp],
|
tags: [OpenAPITags.GlobalIdp],
|
||||||
request: {
|
request: {
|
||||||
body: {
|
body: {
|
||||||
content: {
|
content: {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ registry.registerPath({
|
|||||||
method: "delete",
|
method: "delete",
|
||||||
path: "/idp/{idpId}",
|
path: "/idp/{idpId}",
|
||||||
description: "Delete IDP.",
|
description: "Delete IDP.",
|
||||||
tags: [OpenAPITags.Idp],
|
tags: [OpenAPITags.GlobalIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ registry.registerPath({
|
|||||||
method: "delete",
|
method: "delete",
|
||||||
path: "/idp/{idpId}/org/{orgId}",
|
path: "/idp/{idpId}/org/{orgId}",
|
||||||
description: "Create an OIDC IdP for an organization.",
|
description: "Create an OIDC IdP for an organization.",
|
||||||
tags: [OpenAPITags.Idp],
|
tags: [OpenAPITags.GlobalIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/idp/{idpId}",
|
path: "/idp/{idpId}",
|
||||||
description: "Get an IDP by its IDP ID.",
|
description: "Get an IDP by its IDP ID.",
|
||||||
tags: [OpenAPITags.Idp],
|
tags: [OpenAPITags.GlobalIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema
|
params: paramsSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/idp/{idpId}/org",
|
path: "/idp/{idpId}/org",
|
||||||
description: "List all org policies on an IDP.",
|
description: "List all org policies on an IDP.",
|
||||||
tags: [OpenAPITags.Idp],
|
tags: [OpenAPITags.GlobalIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
query: querySchema
|
query: querySchema
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/idp",
|
path: "/idp",
|
||||||
description: "List all IDP in the system.",
|
description: "List all IDP in the system.",
|
||||||
tags: [OpenAPITags.Idp],
|
tags: [OpenAPITags.GlobalIdp],
|
||||||
request: {
|
request: {
|
||||||
query: querySchema
|
query: querySchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/idp/{idpId}/org/{orgId}",
|
path: "/idp/{idpId}/org/{orgId}",
|
||||||
description: "Update an IDP org policy.",
|
description: "Update an IDP org policy.",
|
||||||
tags: [OpenAPITags.Idp],
|
tags: [OpenAPITags.GlobalIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/idp/{idpId}/oidc",
|
path: "/idp/{idpId}/oidc",
|
||||||
description: "Update an OIDC IdP.",
|
description: "Update an OIDC IdP.",
|
||||||
tags: [OpenAPITags.Idp],
|
tags: [OpenAPITags.GlobalIdp],
|
||||||
request: {
|
request: {
|
||||||
params: paramsSchema,
|
params: paramsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ import {
|
|||||||
verifyApiKeyClientAccess,
|
verifyApiKeyClientAccess,
|
||||||
verifyApiKeySiteResourceAccess,
|
verifyApiKeySiteResourceAccess,
|
||||||
verifyApiKeySetResourceClients,
|
verifyApiKeySetResourceClients,
|
||||||
verifyLimits
|
verifyLimits,
|
||||||
|
verifyApiKeyDomainAccess
|
||||||
} from "@server/middlewares";
|
} from "@server/middlewares";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
@@ -347,6 +348,56 @@ authenticated.get(
|
|||||||
domain.listDomains
|
domain.listDomains
|
||||||
);
|
);
|
||||||
|
|
||||||
|
authenticated.get(
|
||||||
|
"/org/:orgId/domain/:domainId",
|
||||||
|
verifyApiKeyOrgAccess,
|
||||||
|
verifyApiKeyDomainAccess,
|
||||||
|
verifyApiKeyHasAction(ActionsEnum.getDomain),
|
||||||
|
domain.getDomain
|
||||||
|
);
|
||||||
|
|
||||||
|
authenticated.put(
|
||||||
|
"/org/:orgId/domain",
|
||||||
|
verifyApiKeyOrgAccess,
|
||||||
|
verifyApiKeyHasAction(ActionsEnum.createOrgDomain),
|
||||||
|
logActionAudit(ActionsEnum.createOrgDomain),
|
||||||
|
domain.createOrgDomain
|
||||||
|
);
|
||||||
|
|
||||||
|
authenticated.patch(
|
||||||
|
"/org/:orgId/domain/:domainId",
|
||||||
|
verifyApiKeyOrgAccess,
|
||||||
|
verifyApiKeyDomainAccess,
|
||||||
|
verifyApiKeyHasAction(ActionsEnum.updateOrgDomain),
|
||||||
|
domain.updateOrgDomain
|
||||||
|
);
|
||||||
|
|
||||||
|
authenticated.delete(
|
||||||
|
"/org/:orgId/domain/:domainId",
|
||||||
|
verifyApiKeyOrgAccess,
|
||||||
|
verifyApiKeyDomainAccess,
|
||||||
|
verifyApiKeyHasAction(ActionsEnum.deleteOrgDomain),
|
||||||
|
logActionAudit(ActionsEnum.deleteOrgDomain),
|
||||||
|
domain.deleteAccountDomain
|
||||||
|
);
|
||||||
|
|
||||||
|
authenticated.get(
|
||||||
|
"/org/:orgId/domain/:domainId/dns-records",
|
||||||
|
verifyApiKeyOrgAccess,
|
||||||
|
verifyApiKeyDomainAccess,
|
||||||
|
verifyApiKeyHasAction(ActionsEnum.getDNSRecords),
|
||||||
|
domain.getDNSRecords
|
||||||
|
);
|
||||||
|
|
||||||
|
authenticated.post(
|
||||||
|
"/org/:orgId/domain/:domainId/restart",
|
||||||
|
verifyApiKeyOrgAccess,
|
||||||
|
verifyApiKeyDomainAccess,
|
||||||
|
verifyApiKeyHasAction(ActionsEnum.restartOrgDomain),
|
||||||
|
logActionAudit(ActionsEnum.restartOrgDomain),
|
||||||
|
domain.restartOrgDomain
|
||||||
|
);
|
||||||
|
|
||||||
authenticated.get(
|
authenticated.get(
|
||||||
"/org/:orgId/invitations",
|
"/org/:orgId/invitations",
|
||||||
verifyApiKeyOrgAccess,
|
verifyApiKeyOrgAccess,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/resource/{resourceId}/whitelist/add",
|
path: "/resource/{resourceId}/whitelist/add",
|
||||||
description: "Add a single email to the resource whitelist.",
|
description: "Add a single email to the resource whitelist.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: addEmailToResourceWhitelistParamsSchema,
|
params: addEmailToResourceWhitelistParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/resource/{resourceId}/roles/add",
|
path: "/resource/{resourceId}/roles/add",
|
||||||
description: "Add a single role to a resource.",
|
description: "Add a single role to a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Role],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: addRoleToResourceParamsSchema,
|
params: addRoleToResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/resource/{resourceId}/users/add",
|
path: "/resource/{resourceId}/users/add",
|
||||||
description: "Add a single user to a resource.",
|
description: "Add a single user to a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.User],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.User],
|
||||||
request: {
|
request: {
|
||||||
params: addUserToResourceParamsSchema,
|
params: addUserToResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/org/{orgId}/resource",
|
path: "/org/{orgId}/resource",
|
||||||
description: "Create a resource.",
|
description: "Create a resource.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: createResourceParamsSchema,
|
params: createResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/resource/{resourceId}/rule",
|
path: "/resource/{resourceId}/rule",
|
||||||
description: "Create a resource rule.",
|
description: "Create a resource rule.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Rule],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Rule],
|
||||||
request: {
|
request: {
|
||||||
params: createResourceRuleParamsSchema,
|
params: createResourceRuleParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ registry.registerPath({
|
|||||||
method: "delete",
|
method: "delete",
|
||||||
path: "/resource/{resourceId}",
|
path: "/resource/{resourceId}",
|
||||||
description: "Delete a resource.",
|
description: "Delete a resource.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: deleteResourceSchema
|
params: deleteResourceSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ registry.registerPath({
|
|||||||
method: "delete",
|
method: "delete",
|
||||||
path: "/resource/{resourceId}/rule/{ruleId}",
|
path: "/resource/{resourceId}/rule/{ruleId}",
|
||||||
description: "Delete a resource rule.",
|
description: "Delete a resource rule.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Rule],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Rule],
|
||||||
request: {
|
request: {
|
||||||
params: deleteResourceRuleSchema
|
params: deleteResourceRuleSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ registry.registerPath({
|
|||||||
path: "/org/{orgId}/resource/{niceId}",
|
path: "/org/{orgId}/resource/{niceId}",
|
||||||
description:
|
description:
|
||||||
"Get a resource by orgId and niceId. NiceId is a readable ID for the resource and unique on a per org basis.",
|
"Get a resource by orgId and niceId. NiceId is a readable ID for the resource and unique on a per org basis.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
orgId: z.string(),
|
orgId: z.string(),
|
||||||
@@ -68,7 +68,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/resource/{resourceId}",
|
path: "/resource/{resourceId}",
|
||||||
description: "Get a resource by resourceId.",
|
description: "Get a resource by resourceId.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
resourceId: z.number()
|
resourceId: z.number()
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/resource/{resourceId}/whitelist",
|
path: "/resource/{resourceId}/whitelist",
|
||||||
description: "Get the whitelist of emails for a specific resource.",
|
description: "Get the whitelist of emails for a specific resource.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: getResourceWhitelistSchema
|
params: getResourceWhitelistSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/resources-names",
|
path: "/org/{orgId}/resources-names",
|
||||||
description: "List all resource names for an organization.",
|
description: "List all resource names for an organization.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/resource/{resourceId}/roles",
|
path: "/resource/{resourceId}/roles",
|
||||||
description: "List all roles for a resource.",
|
description: "List all roles for a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Role],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: listResourceRolesSchema
|
params: listResourceRolesSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/resource/{resourceId}/rules",
|
path: "/resource/{resourceId}/rules",
|
||||||
description: "List rules for a resource.",
|
description: "List rules for a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Rule],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Rule],
|
||||||
request: {
|
request: {
|
||||||
params: listResourceRulesParamsSchema,
|
params: listResourceRulesParamsSchema,
|
||||||
query: listResourceRulesSchema
|
query: listResourceRulesSchema
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/resource/{resourceId}/users",
|
path: "/resource/{resourceId}/users",
|
||||||
description: "List all users for a resource.",
|
description: "List all users for a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.User],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.User],
|
||||||
request: {
|
request: {
|
||||||
params: listResourceUsersSchema
|
params: listResourceUsersSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/resources",
|
path: "/org/{orgId}/resources",
|
||||||
description: "List resources for an organization.",
|
description: "List resources for an organization.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/resource/{resourceId}/whitelist/remove",
|
path: "/resource/{resourceId}/whitelist/remove",
|
||||||
description: "Remove a single email from the resource whitelist.",
|
description: "Remove a single email from the resource whitelist.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: removeEmailFromResourceWhitelistParamsSchema,
|
params: removeEmailFromResourceWhitelistParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/resource/{resourceId}/roles/remove",
|
path: "/resource/{resourceId}/roles/remove",
|
||||||
description: "Remove a single role from a resource.",
|
description: "Remove a single role from a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Role],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: removeRoleFromResourceParamsSchema,
|
params: removeRoleFromResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/resource/{resourceId}/users/remove",
|
path: "/resource/{resourceId}/users/remove",
|
||||||
description: "Remove a single user from a resource.",
|
description: "Remove a single user from a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.User],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.User],
|
||||||
request: {
|
request: {
|
||||||
params: removeUserFromResourceParamsSchema,
|
params: removeUserFromResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ registry.registerPath({
|
|||||||
path: "/resource/{resourceId}/header-auth",
|
path: "/resource/{resourceId}/header-auth",
|
||||||
description:
|
description:
|
||||||
"Set or update the header authentication for a resource. If user and password is not provided, it will remove the header authentication.",
|
"Set or update the header authentication for a resource. If user and password is not provided, it will remove the header authentication.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: setResourceAuthMethodsParamsSchema,
|
params: setResourceAuthMethodsParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ registry.registerPath({
|
|||||||
path: "/resource/{resourceId}/password",
|
path: "/resource/{resourceId}/password",
|
||||||
description:
|
description:
|
||||||
"Set the password for a resource. Setting the password to null will remove it.",
|
"Set the password for a resource. Setting the password to null will remove it.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: setResourceAuthMethodsParamsSchema,
|
params: setResourceAuthMethodsParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ registry.registerPath({
|
|||||||
path: "/resource/{resourceId}/pincode",
|
path: "/resource/{resourceId}/pincode",
|
||||||
description:
|
description:
|
||||||
"Set the PIN code for a resource. Setting the PIN code to null will remove it.",
|
"Set the PIN code for a resource. Setting the PIN code to null will remove it.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: setResourceAuthMethodsParamsSchema,
|
params: setResourceAuthMethodsParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ registry.registerPath({
|
|||||||
path: "/resource/{resourceId}/roles",
|
path: "/resource/{resourceId}/roles",
|
||||||
description:
|
description:
|
||||||
"Set roles for a resource. This will replace all existing roles.",
|
"Set roles for a resource. This will replace all existing roles.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Role],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: setResourceRolesParamsSchema,
|
params: setResourceRolesParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ registry.registerPath({
|
|||||||
path: "/resource/{resourceId}/users",
|
path: "/resource/{resourceId}/users",
|
||||||
description:
|
description:
|
||||||
"Set users for a resource. This will replace all existing users.",
|
"Set users for a resource. This will replace all existing users.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.User],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.User],
|
||||||
request: {
|
request: {
|
||||||
params: setUserResourcesParamsSchema,
|
params: setUserResourcesParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ registry.registerPath({
|
|||||||
path: "/resource/{resourceId}/whitelist",
|
path: "/resource/{resourceId}/whitelist",
|
||||||
description:
|
description:
|
||||||
"Set email whitelist for a resource. This will replace all existing emails.",
|
"Set email whitelist for a resource. This will replace all existing emails.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: setResourceWhitelistParamsSchema,
|
params: setResourceWhitelistParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/resource/{resourceId}",
|
path: "/resource/{resourceId}",
|
||||||
description: "Update a resource.",
|
description: "Update a resource.",
|
||||||
tags: [OpenAPITags.Resource],
|
tags: [OpenAPITags.PublicResource],
|
||||||
request: {
|
request: {
|
||||||
params: updateResourceParamsSchema,
|
params: updateResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/resource/{resourceId}/rule/{ruleId}",
|
path: "/resource/{resourceId}/rule/{ruleId}",
|
||||||
description: "Update a resource rule.",
|
description: "Update a resource rule.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Rule],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Rule],
|
||||||
request: {
|
request: {
|
||||||
params: updateResourceRuleParamsSchema,
|
params: updateResourceRuleParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/org/{orgId}/role",
|
path: "/org/{orgId}/role",
|
||||||
description: "Create a role.",
|
description: "Create a role.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Role],
|
tags: [OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: createRoleParamsSchema,
|
params: createRoleParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { and, eq, inArray, sql } from "drizzle-orm";
|
|||||||
import { ActionsEnum } from "@server/auth/actions";
|
import { ActionsEnum } from "@server/auth/actions";
|
||||||
import { NextFunction, Request, Response } from "express";
|
import { NextFunction, Request, Response } from "express";
|
||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import { z } from "zod";
|
import { object, z } from "zod";
|
||||||
import { fromError } from "zod-validation-error";
|
import { fromError } from "zod-validation-error";
|
||||||
|
|
||||||
const listRolesParamsSchema = z.strictObject({
|
const listRolesParamsSchema = z.strictObject({
|
||||||
@@ -64,7 +64,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/roles",
|
path: "/org/{orgId}/roles",
|
||||||
description: "List roles.",
|
description: "List roles.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Role],
|
tags: [OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: listRolesParamsSchema,
|
params: listRolesParamsSchema,
|
||||||
query: listRolesSchema
|
query: listRolesSchema
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/org/{orgId}/site",
|
path: "/org/{orgId}/site",
|
||||||
description: "Create a new site.",
|
description: "Create a new site.",
|
||||||
tags: [OpenAPITags.Site, OpenAPITags.Org],
|
tags: [OpenAPITags.Site],
|
||||||
request: {
|
request: {
|
||||||
params: createSiteParamsSchema,
|
params: createSiteParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
@@ -292,7 +292,7 @@ export async function createSite(
|
|||||||
if (type == "newt") {
|
if (type == "newt") {
|
||||||
[newSite] = await trx
|
[newSite] = await trx
|
||||||
.insert(sites)
|
.insert(sites)
|
||||||
.values({
|
.values({ // NOTE: NO SUBNET OR EXIT NODE ID PASSED IN HERE BECAUSE ITS NOW CHOSEN ON CONNECT
|
||||||
orgId,
|
orgId,
|
||||||
name,
|
name,
|
||||||
niceId,
|
niceId,
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ registry.registerPath({
|
|||||||
path: "/org/{orgId}/site/{niceId}",
|
path: "/org/{orgId}/site/{niceId}",
|
||||||
description:
|
description:
|
||||||
"Get a site by orgId and niceId. NiceId is a readable ID for the site and unique on a per org basis.",
|
"Get a site by orgId and niceId. NiceId is a readable ID for the site and unique on a per org basis.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Site],
|
tags: [OpenAPITags.Site],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
orgId: z.string(),
|
orgId: z.string(),
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/sites",
|
path: "/org/{orgId}/sites",
|
||||||
description: "List all sites in an organization",
|
description: "List all sites in an organization",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Site],
|
tags: [OpenAPITags.Site],
|
||||||
request: {
|
request: {
|
||||||
params: listSitesParamsSchema,
|
params: listSitesParamsSchema,
|
||||||
query: listSitesSchema
|
query: listSitesSchema
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ registry.registerPath({
|
|||||||
path: "/org/{orgId}/pick-site-defaults",
|
path: "/org/{orgId}/pick-site-defaults",
|
||||||
description:
|
description:
|
||||||
"Return pre-requisite data for creating a site, such as the exit node, subnet, Newt credentials, etc.",
|
"Return pre-requisite data for creating a site, such as the exit node, subnet, Newt credentials, etc.",
|
||||||
tags: [OpenAPITags.Org, OpenAPITags.Site],
|
tags: [OpenAPITags.Site],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
orgId: z.string()
|
orgId: z.string()
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ registry.registerPath({
|
|||||||
path: "/site-resource/{siteResourceId}/clients/add",
|
path: "/site-resource/{siteResourceId}/clients/add",
|
||||||
description:
|
description:
|
||||||
"Add a single client to a site resource. Clients with a userId cannot be added.",
|
"Add a single client to a site resource. Clients with a userId cannot be added.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Client],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.Client],
|
||||||
request: {
|
request: {
|
||||||
params: addClientToSiteResourceParamsSchema,
|
params: addClientToSiteResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/site-resource/{siteResourceId}/roles/add",
|
path: "/site-resource/{siteResourceId}/roles/add",
|
||||||
description: "Add a single role to a site resource.",
|
description: "Add a single role to a site resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Role],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: addRoleToSiteResourceParamsSchema,
|
params: addRoleToSiteResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/site-resource/{siteResourceId}/users/add",
|
path: "/site-resource/{siteResourceId}/users/add",
|
||||||
description: "Add a single user to a site resource.",
|
description: "Add a single user to a site resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.User],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.User],
|
||||||
request: {
|
request: {
|
||||||
params: addUserToSiteResourceParamsSchema,
|
params: addUserToSiteResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/org/{orgId}/site-resource",
|
path: "/org/{orgId}/site-resource",
|
||||||
description: "Create a new site resource.",
|
description: "Create a new site resource.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.PrivateResource],
|
||||||
request: {
|
request: {
|
||||||
params: createSiteResourceParamsSchema,
|
params: createSiteResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ registry.registerPath({
|
|||||||
method: "delete",
|
method: "delete",
|
||||||
path: "/site-resource/{siteResourceId}",
|
path: "/site-resource/{siteResourceId}",
|
||||||
description: "Delete a site resource.",
|
description: "Delete a site resource.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.PrivateResource],
|
||||||
request: {
|
request: {
|
||||||
params: deleteSiteResourceParamsSchema
|
params: deleteSiteResourceParamsSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/site-resource/{siteResourceId}",
|
path: "/site-resource/{siteResourceId}",
|
||||||
description: "Get a specific site resource by siteResourceId.",
|
description: "Get a specific site resource by siteResourceId.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.PrivateResource],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
siteResourceId: z.number(),
|
siteResourceId: z.number(),
|
||||||
@@ -80,7 +80,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/site/{siteId}/resource/nice/{niceId}",
|
path: "/org/{orgId}/site/{siteId}/resource/nice/{niceId}",
|
||||||
description: "Get a specific site resource by niceId.",
|
description: "Get a specific site resource by niceId.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.PrivateResource],
|
||||||
request: {
|
request: {
|
||||||
params: z.object({
|
params: z.object({
|
||||||
niceId: z.string(),
|
niceId: z.string(),
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/site-resources",
|
path: "/org/{orgId}/site-resources",
|
||||||
description: "List all site resources for an organization.",
|
description: "List all site resources for an organization.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.PrivateResource],
|
||||||
request: {
|
request: {
|
||||||
params: listAllSiteResourcesByOrgParamsSchema,
|
params: listAllSiteResourcesByOrgParamsSchema,
|
||||||
query: listAllSiteResourcesByOrgQuerySchema
|
query: listAllSiteResourcesByOrgQuerySchema
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/site-resource/{siteResourceId}/clients",
|
path: "/site-resource/{siteResourceId}/clients",
|
||||||
description: "List all clients for a site resource.",
|
description: "List all clients for a site resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Client],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.Client],
|
||||||
request: {
|
request: {
|
||||||
params: listSiteResourceClientsSchema
|
params: listSiteResourceClientsSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/site-resource/{siteResourceId}/roles",
|
path: "/site-resource/{siteResourceId}/roles",
|
||||||
description: "List all roles for a site resource.",
|
description: "List all roles for a site resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Role],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: listSiteResourceRolesSchema
|
params: listSiteResourceRolesSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/site-resource/{siteResourceId}/users",
|
path: "/site-resource/{siteResourceId}/users",
|
||||||
description: "List all users for a site resource.",
|
description: "List all users for a site resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.User],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.User],
|
||||||
request: {
|
request: {
|
||||||
params: listSiteResourceUsersSchema
|
params: listSiteResourceUsersSchema
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/org/{orgId}/site/{siteId}/resources",
|
path: "/org/{orgId}/site/{siteId}/resources",
|
||||||
description: "List site resources for a site.",
|
description: "List site resources for a site.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.PrivateResource],
|
||||||
request: {
|
request: {
|
||||||
params: listSiteResourcesParamsSchema,
|
params: listSiteResourcesParamsSchema,
|
||||||
query: listSiteResourcesQuerySchema
|
query: listSiteResourcesQuerySchema
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ registry.registerPath({
|
|||||||
path: "/site-resource/{siteResourceId}/clients/remove",
|
path: "/site-resource/{siteResourceId}/clients/remove",
|
||||||
description:
|
description:
|
||||||
"Remove a single client from a site resource. Clients with a userId cannot be removed.",
|
"Remove a single client from a site resource. Clients with a userId cannot be removed.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Client],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.Client],
|
||||||
request: {
|
request: {
|
||||||
params: removeClientFromSiteResourceParamsSchema,
|
params: removeClientFromSiteResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/site-resource/{siteResourceId}/roles/remove",
|
path: "/site-resource/{siteResourceId}/roles/remove",
|
||||||
description: "Remove a single role from a site resource.",
|
description: "Remove a single role from a site resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Role],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: removeRoleFromSiteResourceParamsSchema,
|
params: removeRoleFromSiteResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/site-resource/{siteResourceId}/users/remove",
|
path: "/site-resource/{siteResourceId}/users/remove",
|
||||||
description: "Remove a single user from a site resource.",
|
description: "Remove a single user from a site resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.User],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.User],
|
||||||
request: {
|
request: {
|
||||||
params: removeUserFromSiteResourceParamsSchema,
|
params: removeUserFromSiteResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ registry.registerPath({
|
|||||||
path: "/site-resource/{siteResourceId}/clients",
|
path: "/site-resource/{siteResourceId}/clients",
|
||||||
description:
|
description:
|
||||||
"Set clients for a site resource. This will replace all existing clients. Clients with a userId cannot be added.",
|
"Set clients for a site resource. This will replace all existing clients. Clients with a userId cannot be added.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Client],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.Client],
|
||||||
request: {
|
request: {
|
||||||
params: setSiteResourceClientsParamsSchema,
|
params: setSiteResourceClientsParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ registry.registerPath({
|
|||||||
path: "/site-resource/{siteResourceId}/roles",
|
path: "/site-resource/{siteResourceId}/roles",
|
||||||
description:
|
description:
|
||||||
"Set roles for a site resource. This will replace all existing roles.",
|
"Set roles for a site resource. This will replace all existing roles.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Role],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.Role],
|
||||||
request: {
|
request: {
|
||||||
params: setSiteResourceRolesParamsSchema,
|
params: setSiteResourceRolesParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ registry.registerPath({
|
|||||||
path: "/site-resource/{siteResourceId}/users",
|
path: "/site-resource/{siteResourceId}/users",
|
||||||
description:
|
description:
|
||||||
"Set users for a site resource. This will replace all existing users.",
|
"Set users for a site resource. This will replace all existing users.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.User],
|
tags: [OpenAPITags.PrivateResource, OpenAPITags.User],
|
||||||
request: {
|
request: {
|
||||||
params: setSiteResourceUsersParamsSchema,
|
params: setSiteResourceUsersParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ registry.registerPath({
|
|||||||
method: "post",
|
method: "post",
|
||||||
path: "/site-resource/{siteResourceId}",
|
path: "/site-resource/{siteResourceId}",
|
||||||
description: "Update a site resource.",
|
description: "Update a site resource.",
|
||||||
tags: [OpenAPITags.Client, OpenAPITags.Org],
|
tags: [OpenAPITags.PrivateResource],
|
||||||
request: {
|
request: {
|
||||||
params: updateSiteResourceParamsSchema,
|
params: updateSiteResourceParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ registry.registerPath({
|
|||||||
method: "put",
|
method: "put",
|
||||||
path: "/resource/{resourceId}/target",
|
path: "/resource/{resourceId}/target",
|
||||||
description: "Create a target for a resource.",
|
description: "Create a target for a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Target],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Target],
|
||||||
request: {
|
request: {
|
||||||
params: createTargetParamsSchema,
|
params: createTargetParamsSchema,
|
||||||
body: {
|
body: {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ registry.registerPath({
|
|||||||
method: "get",
|
method: "get",
|
||||||
path: "/resource/{resourceId}/targets",
|
path: "/resource/{resourceId}/targets",
|
||||||
description: "List targets for a resource.",
|
description: "List targets for a resource.",
|
||||||
tags: [OpenAPITags.Resource, OpenAPITags.Target],
|
tags: [OpenAPITags.PublicResource, OpenAPITags.Target],
|
||||||
request: {
|
request: {
|
||||||
params: listTargetsParamsSchema,
|
params: listTargetsParamsSchema,
|
||||||
query: listTargetsSchema
|
query: listTargetsSchema
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user