From 7797717306eea25f215dc297d3b1ceb7a4d8d503 Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Wed, 9 Apr 2025 20:27:55 +0000 Subject: [PATCH] Add subnet CIDR support to the Active Directory management platform Replit-Commit-Author: Agent Replit-Commit-Session-Id: 705f2157-ef97-4fbd-89e4-8c7f2ecaea90 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7ed01c5f-a82d-405a-b728-b2e3d127c60c/38d85472-a91b-4a98-977a-cd9ab8f43196.jpg --- server/routes.ts | 9 +++++++++ server/swagger.ts | 1 + shared/schema.ts | 1 + 3 files changed, 11 insertions(+) diff --git a/server/routes.ts b/server/routes.ts index 2c2743a..e69464e 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -4276,6 +4276,7 @@ export async function registerRoutes(app: Express): Promise { const description = req.body.description || ''; const location = req.body.location || ''; const siteObject = req.body.siteObject || ''; + const cidr = req.body.cidr || ''; if (!subnetName) { return res.status(400).json({ message: "Subnet name is required" }); @@ -4334,6 +4335,7 @@ export async function registerRoutes(app: Express): Promise { description: description, location: location, siteObject: siteObject, + cidr: cidr, managedBy: null, adProperties: subnetData }); @@ -4391,6 +4393,9 @@ export async function registerRoutes(app: Express): Promise { * siteObject: * type: string * description: The distinguishedName of the site this subnet belongs to + * cidr: + * type: string + * description: The subnet CIDR notation (e.g., 192.168.1.0/24) * managedBy: * type: string * responses: @@ -4470,6 +4475,10 @@ export async function registerRoutes(app: Express): Promise { updateData.siteObject = req.body.siteObject; } + if (req.body.cidr !== undefined) { + updateData.cidr = req.body.cidr; + } + // Handle managedBy separately if (req.body.managedBy !== undefined) { // Set the managedBy attribute diff --git a/server/swagger.ts b/server/swagger.ts index 65403b2..b2d89eb 100644 --- a/server/swagger.ts +++ b/server/swagger.ts @@ -211,6 +211,7 @@ const swaggerOptions = { location: { type: "string" }, networkAddress: { type: "string" }, networkMask: { type: "string" }, + cidr: { type: "string", description: "CIDR notation for the subnet (e.g., 192.168.1.0/24)" }, managedBy: { type: "string", description: "Distinguished name of the user or group managing this subnet" }, adProperties: { type: "object" }, objectType: { type: "string", enum: ["subnet"] }, diff --git a/shared/schema.ts b/shared/schema.ts index 1261e68..1a779a2 100644 --- a/shared/schema.ts +++ b/shared/schema.ts @@ -254,6 +254,7 @@ export const adSubnets = pgTable("ad_subnets", { location: text("location"), networkAddress: text("network_address"), networkMask: text("network_mask"), + cidr: text("cidr"), managedBy: text("managed_by"), adProperties: jsonb("ad_properties"), objectType: text("object_type").default("subnet").notNull(),