Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Update various identities items

Tuan Dangc94b7d63f696
diff --git a/backend/spec.json b/backend/spec.json
index adb8af4111..e5ecb5df04 100644
--- a/backend/spec.json
+++ b/backend/spec.json
@@ -4962,7 +4962,8 @@
},
"security": [
{
- "apiKeyAuth": []
+ "apiKeyAuth": [],
+ "bearerAuth": []
}
]
}
diff --git a/backend/src/controllers/v2/organizationsController.ts b/backend/src/controllers/v2/organizationsController.ts
index f939f9072d..c6c49e23d2 100644
--- a/backend/src/controllers/v2/organizationsController.ts
+++ b/backend/src/controllers/v2/organizationsController.ts
@@ -1,9 +1,13 @@
import { Request, Response } from "express";
import { Types } from "mongoose";
import {
- IdentityMembershipOrg,
- Membership,
+ IWorkspace,
+ Identity,
+ IdentityMembership,
+ IdentityMembershipOrg,
+ Membership,
MembershipOrg,
+ User,
Workspace
} from "../../models";
import { Role } from "../../ee/models";
@@ -298,7 +302,8 @@ export const getOrganizationWorkspaces = async (req: Request, res: Response) =>
#swagger.description = 'Return projects in organization that user is part of'
#swagger.security = [{
- "apiKeyAuth": []
+ "apiKeyAuth": [],
+ "bearerAuth": []
}]
#swagger.parameters['organizationId'] = {
@@ -326,6 +331,7 @@ export const getOrganizationWorkspaces = async (req: Request, res: Response) =>
}
}
*/
+
const {
params: { organizationId }
} = await validateRequest(reqValidator.GetOrgWorkspacesv2, req);
@@ -351,13 +357,27 @@ export const getOrganizationWorkspaces = async (req: Request, res: Response) =>
).map((w) => w._id.toString())
);
- const workspaces = (
- await Membership.find({
- user: req.user._id
- }).populate("workspace")
- )
- .filter((m) => workspacesSet.has(m.workspace._id.toString()))
- .map((m) => m.workspace);
+ let workspaces: IWorkspace[] = [];
+
+ if (req.authData.authPayload instanceof Identity) {
+ workspaces = (
+ await IdentityMembership.find({
+ identity: req.authData.authPayload._id
+ }).populate<{ workspace: IWorkspace }>("workspace")
+ )
+ .filter((m) => workspacesSet.has(m.workspace._id.toString()))
+ .map((m) => m.workspace);
+ }
+
+ if (req.authData.authPayload instanceof User) {
+ workspaces = (
+ await Membership.find({
+ user: req.authData.authPayload._id
+ }).populate<{ workspace: IWorkspace }>("workspace")
+ )
+ .filter((m) => workspacesSet.has(m.workspace._id.toString()))
+ .map((m) => m.workspace);
+ }
return res.status(200).send({
workspaces
diff --git a/docs/api-reference/endpoints/organizations/workspaces.mdx b/docs/api-reference/endpoints/organizations/workspaces.mdx
index 34671fe73f..2e2728e0c0 100644
--- a/docs/api-reference/endpoints/organizations/workspaces.mdx
+++ b/docs/api-reference/endpoints/organizations/workspaces.mdx
@@ -1,10 +1,4 @@
---
title: "Get Projects"
openapi: "GET /api/v2/organizations/{organizationId}/workspaces"
----
-
-<Warning>
- This endpoint will be deprecated in the near future in Q1/Q2 2024.
-
- We recommend switching to using [identities](/documentation/platform/identities/overview).
-</Warning>
\ No newline at end of file
+---
\ No newline at end of file
diff --git a/docs/spec.yaml b/docs/spec.yaml
index a0a2dc13f9..c3d0503953 100644
--- a/docs/spec.yaml
+++ b/docs/spec.yaml
@@ -3133,6 +3133,7 @@ paths:
description: Projects of organization
security:
- apiKeyAuth: []
+ bearerAuth: []
/api/v2/organizations/:
post:
description: ''
diff --git a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentitySection.tsx b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentitySection.tsx
index 7b8c55bf3a..2807103c3e 100644
--- a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentitySection.tsx
+++ b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentitySection.tsx
@@ -72,9 +72,9 @@ export const IdentitySection = withPermission(
</p>
<div className="flex justify-end w-full pr-4">
<Link href="https://infisical.com/docs/documentation/platform/identities/overview">
- <span className="rounded-md px-4 py-2 w-max text-mineshaft-200 hover:text-white bg-mineshaft-600 border border-mineshaft-500 hover:bg-primary/10 hover:border-primary/40 duration-200 cursor-pointer">
+ <a target="_blank" rel="noopener noreferrer" className="rounded-md px-4 py-2 w-max text-mineshaft-200 hover:text-white bg-mineshaft-600 border border-mineshaft-500 hover:bg-primary/10 hover:border-primary/40 duration-200 cursor-pointer">
Documentation <FontAwesomeIcon icon={faArrowUpRightFromSquare} className="text-xs mb-[0.06rem] ml-1"/>
- </span>
+ </a>
</Link>
</div>
<OrgPermissionCan
diff --git a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx
index b9dca1ad1d..03b458ad97 100644
--- a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx
+++ b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx
@@ -98,6 +98,7 @@ export const IdentityTable = ({
<THead>
<Tr>
<Th>Name</Th>
+ <Th>ID</Th>
<Th>Role</Th>
<Th>Auth Method</Th>
<Th className="w-5" />
@@ -120,6 +121,7 @@ export const IdentityTable = ({
return (
<Tr className="h-10" key={`identity-${_id}`}>
<Td>{name}</Td>
+ <Td>{_id}</Td>
<Td>
<OrgPermissionCan
I={OrgPermissionActions.Edit}