mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Wired most of the frontend to support ghost users
This commit is contained in:
@@ -238,7 +238,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
|||||||
projectId: newProjectId
|
projectId: newProjectId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-promise-executor-return -- We do this because the function returns too fast, which sometimes causes an error when the user is redirected.
|
// eslint-disable-next-line no-promise-executor-return -- We do this because the function returns too fast, which sometimes causes an error when the user is redirected.
|
||||||
await new Promise((resolve) => setTimeout(resolve, 2_000));
|
await new Promise((resolve) => setTimeout(resolve, 2_000));
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
|||||||
createNotification({ text: "Failed to create workspace", type: "error" });
|
createNotification({ text: "Failed to create workspace", type: "error" });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="dark hidden h-screen w-full flex-col overflow-x-hidden md:flex">
|
<div className="dark hidden h-screen w-full flex-col overflow-x-hidden md:flex">
|
||||||
@@ -288,41 +288,43 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
|||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="start" className="p-1">
|
<DropdownMenuContent align="start" className="p-1">
|
||||||
<div className="px-2 py-1 text-xs text-mineshaft-400">{user?.email}</div>
|
<div className="px-2 py-1 text-xs text-mineshaft-400">{user?.email}</div>
|
||||||
{orgs?.map((org) => {
|
{orgs?.map((org) => {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuItem key={org.id}>
|
<DropdownMenuItem key={org.id}>
|
||||||
<Button
|
<Button
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
if (currentOrg?.id === org.id) return;
|
if (currentOrg?.id === org.id) return;
|
||||||
|
|
||||||
if (org.authEnforced) {
|
|
||||||
// org has an org-level auth method enabled (e.g. SAML)
|
|
||||||
// -> logout + redirect to SAML SSO
|
|
||||||
|
|
||||||
await logout.mutateAsync();
|
if (org.authEnforced) {
|
||||||
window.open(`/api/v1/sso/redirect/saml2/organizations/${org.slug}`);
|
// org has an org-level auth method enabled (e.g. SAML)
|
||||||
window.close();
|
// -> logout + redirect to SAML SSO
|
||||||
return;
|
|
||||||
|
await logout.mutateAsync();
|
||||||
|
window.open(
|
||||||
|
`/api/v1/sso/redirect/saml2/organizations/${org.slug}`
|
||||||
|
);
|
||||||
|
window.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
changeOrg(org?.id);
|
||||||
|
}}
|
||||||
|
variant="plain"
|
||||||
|
colorSchema="secondary"
|
||||||
|
size="xs"
|
||||||
|
className="flex w-full items-center justify-start p-0 font-normal"
|
||||||
|
leftIcon={
|
||||||
|
currentOrg?.id === org.id && (
|
||||||
|
<FontAwesomeIcon icon={faCheck} className="mr-3 text-primary" />
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
>
|
||||||
changeOrg(org?.id)
|
<div className="flex w-full items-center justify-between">
|
||||||
}}
|
{org.name}
|
||||||
variant="plain"
|
</div>
|
||||||
colorSchema="secondary"
|
</Button>
|
||||||
size="xs"
|
</DropdownMenuItem>
|
||||||
className="flex w-full items-center justify-start p-0 font-normal"
|
);
|
||||||
leftIcon={
|
|
||||||
currentOrg?.id === org.id && (
|
|
||||||
<FontAwesomeIcon icon={faCheck} className="mr-3 text-primary" />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<div className="flex w-full items-center justify-between">
|
|
||||||
{org.name}
|
|
||||||
</div>
|
|
||||||
</Button>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
)
|
|
||||||
})}
|
})}
|
||||||
{/* <DropdownMenuItem key="add-org">
|
{/* <DropdownMenuItem key="add-org">
|
||||||
<Button
|
<Button
|
||||||
@@ -598,7 +600,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
{(window.location.origin.includes("https://app.infisical.com")) && (
|
{window.location.origin.includes("https://app.infisical.com") && (
|
||||||
<Link href={`/org/${currentOrg?.id}/billing`} passHref>
|
<Link href={`/org/${currentOrg?.id}/billing`} passHref>
|
||||||
<a>
|
<a>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
|||||||
@@ -509,7 +509,6 @@ const OrganizationPage = withPermission(
|
|||||||
projectName: name
|
projectName: name
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
if (addMembers) {
|
if (addMembers) {
|
||||||
const orgUsers = await fetchOrgUsers(currentOrg);
|
const orgUsers = await fetchOrgUsers(currentOrg);
|
||||||
|
|
||||||
@@ -524,23 +523,6 @@ const OrganizationPage = withPermission(
|
|||||||
// eslint-disable-next-line no-promise-executor-return -- We do this because the function returns too fast, which sometimes causes an error when the user is redirected.
|
// eslint-disable-next-line no-promise-executor-return -- We do this because the function returns too fast, which sometimes causes an error when the user is redirected.
|
||||||
await new Promise((resolve) => setTimeout(resolve, 2_000));
|
await new Promise((resolve) => setTimeout(resolve, 2_000));
|
||||||
|
|
||||||
const decryptKey = await fetchUserWsKey(newWorkspaceId);
|
|
||||||
|
|
||||||
await addWsUser.mutateAsync({
|
|
||||||
workspaceId: newWorkspaceId,
|
|
||||||
decryptKey,
|
|
||||||
userPrivateKey: PRIVATE_KEY,
|
|
||||||
members: orgUsers
|
|
||||||
.filter(
|
|
||||||
({ status, user: orgUser }) => status === "accepted" && user.email !== orgUser.email
|
|
||||||
)
|
|
||||||
.map(({ user: orgUser, id: orgMembershipId }) => ({
|
|
||||||
userPublicKey: orgUser.publicKey,
|
|
||||||
orgMembershipId
|
|
||||||
}))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
createNotification({ text: "Workspace created", type: "success" });
|
createNotification({ text: "Workspace created", type: "success" });
|
||||||
handlePopUpClose("addNewWs");
|
handlePopUpClose("addNewWs");
|
||||||
createNotification({ text: "Workspace created", type: "success" });
|
createNotification({ text: "Workspace created", type: "success" });
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ export const MemberListTab = () => {
|
|||||||
text: "Failed to add user to project, unknown project type",
|
text: "Failed to add user to project, unknown project type",
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully added user to the project",
|
text: "Successfully added user to the project",
|
||||||
|
|||||||
Reference in New Issue
Block a user