Skip to content

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

Fix: Project roles

Daniel Hougaardf7183347dcdb
diff --git a/frontend/src/hooks/api/roles/queries.tsx b/frontend/src/hooks/api/roles/queries.tsx
index 8647353cb5..d0bf0df575 100644
--- a/frontend/src/hooks/api/roles/queries.tsx
+++ b/frontend/src/hooks/api/roles/queries.tsx
@@ -106,7 +106,7 @@ const getUserProjectPermissions = async ({ workspaceId }: TGetUserProjectPermiss
const { data } = await apiRequest.get<{
data: {
permissions: PackRule<RawRuleOf<MongoAbility<OrgPermissionSet>>>[];
- membership: TProjectMembership;
+ membership: Omit<TProjectMembership, "roles"> & { roles: { role: string }[] };
};
}>(`/api/v1/workspace/${workspaceId}/permissions`, {});
@@ -121,6 +121,14 @@ export const useGetUserProjectPermissions = ({ workspaceId }: TGetUserProjectPer
select: (data) => {
const rule = unpackRules<RawRuleOf<MongoAbility<ProjectPermissionSet>>>(data.permissions);
const ability = createMongoAbility<ProjectPermissionSet>(rule, { conditionsMatcher });
- return { permission: ability, membership: data.membership };
+
+ const membership = {
+ ...data.membership,
+ roles: data.membership.roles.map(({ role }) => {
+ return role;
+ })
+ };
+
+ return { permission: ability, membership };
}
});
diff --git a/frontend/src/hooks/api/users/types.ts b/frontend/src/hooks/api/users/types.ts
index 845030e9fa..572296e75b 100644
--- a/frontend/src/hooks/api/users/types.ts
+++ b/frontend/src/hooks/api/users/types.ts
@@ -62,7 +62,7 @@ export type TProjectMembership = {
createdAt: string;
updatedAt: string;
projectId: string;
- roleId: string;
+ roles: string[];
};
export type TWorkspaceUser = {
@@ -79,29 +79,29 @@ export type TWorkspaceUser = {
organization: string;
roles: (
| {
- id: string;
- role: "owner" | "admin" | "member" | "no-access" | "custom";
- customRoleId: string;
- customRoleName: string;
- customRoleSlug: string;
- isTemporary: false;
- temporaryRange: null;
- temporaryMode: null;
- temporaryAccessEndTime: null;
- temporaryAccessStartTime: null;
- }
+ id: string;
+ role: "owner" | "admin" | "member" | "no-access" | "custom";
+ customRoleId: string;
+ customRoleName: string;
+ customRoleSlug: string;
+ isTemporary: false;
+ temporaryRange: null;
+ temporaryMode: null;
+ temporaryAccessEndTime: null;
+ temporaryAccessStartTime: null;
+ }
| {
- id: string;
- role: "owner" | "admin" | "member" | "no-access" | "custom";
- customRoleId: string;
- customRoleName: string;
- customRoleSlug: string;
- isTemporary: true;
- temporaryRange: string;
- temporaryMode: string;
- temporaryAccessEndTime: string;
- temporaryAccessStartTime: string;
- }
+ id: string;
+ role: "owner" | "admin" | "member" | "no-access" | "custom";
+ customRoleId: string;
+ customRoleName: string;
+ customRoleSlug: string;
+ isTemporary: true;
+ temporaryRange: string;
+ temporaryMode: string;
+ temporaryAccessEndTime: string;
+ temporaryAccessStartTime: string;
+ }
)[];
status: "invited" | "accepted" | "verified" | "completed";
deniedPermissions: any[];