mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 19:16:22 +00:00
feat: updated files on review changes
This commit is contained in:
@@ -20,7 +20,7 @@ export const useProjectPermission = () => {
|
||||
}
|
||||
|
||||
const {
|
||||
data: { permission, membership, impersonation }
|
||||
data: { permission, membership, assumedPrivilegeDetails }
|
||||
} = useSuspenseQuery({
|
||||
queryKey: roleQueryKeys.getUserProjectPermissions({ workspaceId: projectId }),
|
||||
queryFn: () => fetchUserProjectPermissions({ workspaceId: projectId }),
|
||||
@@ -30,7 +30,7 @@ export const useProjectPermission = () => {
|
||||
const ability = evaluatePermissionsAbility(rule);
|
||||
return {
|
||||
permission: ability,
|
||||
impersonation: data.impersonation,
|
||||
assumedPrivilegeDetails: data.assumedPrivilegeDetails,
|
||||
membership: {
|
||||
...data.membership,
|
||||
roles: data.membership.roles.map(({ role }) => role)
|
||||
@@ -44,5 +44,5 @@ export const useProjectPermission = () => {
|
||||
[]
|
||||
);
|
||||
|
||||
return { permission, membership, hasProjectRole, impersonation };
|
||||
return { permission, membership, hasProjectRole, assumedPrivilegeDetails };
|
||||
};
|
||||
|
||||
@@ -138,7 +138,7 @@ export const fetchUserProjectPermissions = async ({
|
||||
data: {
|
||||
permissions: PackRule<RawRuleOf<MongoAbility<OrgPermissionSet>>>[];
|
||||
membership: Omit<TProjectMembership, "roles"> & { roles: { role: string }[] };
|
||||
impersonation?: {
|
||||
assumedPrivilegeDetails?: {
|
||||
actorId: string;
|
||||
actorType: ActorType;
|
||||
actorEmail: string;
|
||||
|
||||
@@ -30,7 +30,7 @@ export const ProjectLayout = () => {
|
||||
const breadcrumbs = matches && "breadcrumbs" in matches ? matches.breadcrumbs : undefined;
|
||||
|
||||
const { t } = useTranslation();
|
||||
const { impersonation } = useProjectPermission();
|
||||
const { assumedPrivilegeDetails } = useProjectPermission();
|
||||
const workspaceId = currentWorkspace?.id || "";
|
||||
const projectSlug = currentWorkspace?.slug || "";
|
||||
|
||||
@@ -64,7 +64,7 @@ export const ProjectLayout = () => {
|
||||
return (
|
||||
<>
|
||||
<div className="dark hidden h-screen w-full flex-col overflow-x-hidden md:flex">
|
||||
{impersonation && <AssumePrivilegeModeBanner />}
|
||||
{assumedPrivilegeDetails && <AssumePrivilegeModeBanner />}
|
||||
<div className="flex flex-grow flex-col overflow-y-hidden md:flex-row">
|
||||
<motion.div
|
||||
key="menu-project-items"
|
||||
|
||||
+4
-4
@@ -9,9 +9,9 @@ import { ActorType } from "@app/hooks/api/auditLogs/enums";
|
||||
export const AssumePrivilegeModeBanner = () => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const exitAssumePrivilegeMode = useRemoveAssumeProjectPrivilege();
|
||||
const { impersonation } = useProjectPermission();
|
||||
const { assumedPrivilegeDetails } = useProjectPermission();
|
||||
|
||||
if (!impersonation) return null;
|
||||
if (!assumedPrivilegeDetails) return null;
|
||||
|
||||
return (
|
||||
<div className="z-10 -mx-4 flex items-center justify-center gap-2 rounded border border-mineshaft-600 bg-primary-400 p-2 text-mineshaft-800 shadow">
|
||||
@@ -19,8 +19,8 @@ export const AssumePrivilegeModeBanner = () => {
|
||||
<FontAwesomeIcon icon={faInfoCircle} className="mr-2" />
|
||||
You are currently viewing the project with privileges of{" "}
|
||||
<b>
|
||||
{impersonation?.actorType === ActorType.IDENTITY ? "identity" : "user"}{" "}
|
||||
{impersonation?.actorName}
|
||||
{assumedPrivilegeDetails?.actorType === ActorType.IDENTITY ? "identity" : "user"}{" "}
|
||||
{assumedPrivilegeDetails?.actorName}
|
||||
</b>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user