mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 15:27:27 +00:00
feat(rbac): fixed ip allow list api
This commit is contained in:
@@ -1,6 +1,14 @@
|
|||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import { PipelineStage, Types } from "mongoose";
|
import { PipelineStage, Types } from "mongoose";
|
||||||
import { Folder, Membership, Secret, ServiceTokenData, TFolderSchema, User } from "../../../models";
|
import {
|
||||||
|
Folder,
|
||||||
|
Membership,
|
||||||
|
Secret,
|
||||||
|
ServiceTokenData,
|
||||||
|
TFolderSchema,
|
||||||
|
User,
|
||||||
|
Workspace
|
||||||
|
} from "../../../models";
|
||||||
import {
|
import {
|
||||||
ActorType,
|
ActorType,
|
||||||
AuditLog,
|
AuditLog,
|
||||||
@@ -41,6 +49,7 @@ import {
|
|||||||
getUserProjectPermissions
|
getUserProjectPermissions
|
||||||
} from "../../services/ProjectRoleService";
|
} from "../../services/ProjectRoleService";
|
||||||
import { ForbiddenError } from "@casl/ability";
|
import { ForbiddenError } from "@casl/ability";
|
||||||
|
import { BadRequestError } from "../../../utils/errors";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return secret snapshots for workspace with id [workspaceId]
|
* Return secret snapshots for workspace with id [workspaceId]
|
||||||
@@ -781,7 +790,10 @@ export const addWorkspaceTrustedIp = async (req: Request, res: Response) => {
|
|||||||
ProjectPermissionSub.IpAllowList
|
ProjectPermissionSub.IpAllowList
|
||||||
);
|
);
|
||||||
|
|
||||||
const plan = await EELicenseService.getPlan(req.workspace.organization);
|
const workspace = await Workspace.findById(workspaceId);
|
||||||
|
if (!workspace) throw BadRequestError({ message: "Workspace not found" });
|
||||||
|
|
||||||
|
const plan = await EELicenseService.getPlan(workspace.organization);
|
||||||
|
|
||||||
if (!plan.ipAllowlisting)
|
if (!plan.ipAllowlisting)
|
||||||
return res.status(400).send({
|
return res.status(400).send({
|
||||||
@@ -844,7 +856,10 @@ export const updateWorkspaceTrustedIp = async (req: Request, res: Response) => {
|
|||||||
ProjectPermissionSub.IpAllowList
|
ProjectPermissionSub.IpAllowList
|
||||||
);
|
);
|
||||||
|
|
||||||
const plan = await EELicenseService.getPlan(req.workspace.organization);
|
const workspace = await Workspace.findById(workspaceId);
|
||||||
|
if (!workspace) throw BadRequestError({ message: "Workspace not found" });
|
||||||
|
|
||||||
|
const plan = await EELicenseService.getPlan(workspace.organization);
|
||||||
|
|
||||||
if (!plan.ipAllowlisting)
|
if (!plan.ipAllowlisting)
|
||||||
return res.status(400).send({
|
return res.status(400).send({
|
||||||
@@ -933,7 +948,10 @@ export const deleteWorkspaceTrustedIp = async (req: Request, res: Response) => {
|
|||||||
ProjectPermissionSub.IpAllowList
|
ProjectPermissionSub.IpAllowList
|
||||||
);
|
);
|
||||||
|
|
||||||
const plan = await EELicenseService.getPlan(req.workspace.organization);
|
const workspace = await Workspace.findById(workspaceId);
|
||||||
|
if (!workspace) throw BadRequestError({ message: "Workspace not found" });
|
||||||
|
|
||||||
|
const plan = await EELicenseService.getPlan(workspace.organization);
|
||||||
|
|
||||||
if (!plan.ipAllowlisting)
|
if (!plan.ipAllowlisting)
|
||||||
return res.status(400).send({
|
return res.status(400).send({
|
||||||
|
|||||||
Reference in New Issue
Block a user