mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Fix type issues
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
export { OrgPermissionProvider, useOrgPermission } from "./OrgPermissionContext";
|
||||
export type { TOrgPermission } from "./types";
|
||||
export {
|
||||
OrgPermissionActions,
|
||||
OrgPermissionSshCertificateTemplateActions,
|
||||
OrgPermissionSubjects} from "./types";
|
||||
export { OrgPermissionActions, OrgPermissionSubjects } from "./types";
|
||||
|
||||
@@ -53,6 +53,6 @@ export type OrgPermissionSet =
|
||||
| [OrgPermissionActions, OrgPermissionSubjects.ProjectTemplates]
|
||||
| [OrgPermissionActions, OrgPermissionSubjects.SshCertificateAuthorities]
|
||||
| [OrgPermissionActions, OrgPermissionSubjects.SshCertificates]
|
||||
| [OrgPermissionSshCertificateTemplateActions, OrgPermissionSubjects.SshCertificateTemplates];
|
||||
| [OrgPermissionActions, OrgPermissionSubjects.SshCertificateTemplates];
|
||||
|
||||
export type TOrgPermission = MongoAbility<OrgPermissionSet>;
|
||||
|
||||
@@ -4,7 +4,6 @@ export type { TOrgPermission } from "./OrgPermissionContext";
|
||||
export {
|
||||
OrgPermissionActions,
|
||||
OrgPermissionProvider,
|
||||
OrgPermissionSshCertificateTemplateActions,
|
||||
OrgPermissionSubjects,
|
||||
useOrgPermission
|
||||
} from "./OrgPermissionContext";
|
||||
|
||||
@@ -13,13 +13,6 @@ const generalPermissionSchema = z
|
||||
})
|
||||
.optional();
|
||||
|
||||
const sshCertificateSchema = z
|
||||
.object({
|
||||
read: z.boolean().optional(),
|
||||
create: z.boolean().optional()
|
||||
})
|
||||
.optional();
|
||||
|
||||
const adminConsolePermissionSchmea = z
|
||||
.object({
|
||||
"access-all-projects": z.boolean().optional()
|
||||
@@ -58,7 +51,7 @@ export const formSchema = z.object({
|
||||
[OrgPermissionSubjects.Kms]: generalPermissionSchema,
|
||||
[OrgPermissionSubjects.ProjectTemplates]: generalPermissionSchema,
|
||||
[OrgPermissionSubjects.SshCertificateAuthorities]: generalPermissionSchema,
|
||||
[OrgPermissionSubjects.SshCertificates]: sshCertificateSchema,
|
||||
[OrgPermissionSubjects.SshCertificates]: generalPermissionSchema,
|
||||
[OrgPermissionSubjects.SshCertificateTemplates]: generalPermissionSchema
|
||||
})
|
||||
.optional()
|
||||
|
||||
@@ -51,11 +51,6 @@ const PROJECT_TEMPLATES_PERMISSIONS = [
|
||||
{ action: "delete", label: "Remove" }
|
||||
] as const;
|
||||
|
||||
const SSH_CERTIFICATES_PERMISSIONS = [
|
||||
{ action: "read", label: "View" },
|
||||
{ action: "create", label: "Create" }
|
||||
] as const;
|
||||
|
||||
const getPermissionList = (option: string) => {
|
||||
switch (option) {
|
||||
case "secret-scanning":
|
||||
@@ -68,8 +63,6 @@ const getPermissionList = (option: string) => {
|
||||
return MEMBERS_PERMISSIONS;
|
||||
case OrgPermissionSubjects.ProjectTemplates:
|
||||
return PROJECT_TEMPLATES_PERMISSIONS;
|
||||
case OrgPermissionSubjects.SshCertificates:
|
||||
return SSH_CERTIFICATES_PERMISSIONS;
|
||||
default:
|
||||
return PERMISSIONS;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { OrgPermissionCan } from "@app/components/permissions";
|
||||
import { DeleteActionModal, IconButton } from "@app/components/v2";
|
||||
import { OrgPermissionSshCertificateTemplateActions, OrgPermissionSubjects } from "@app/context";
|
||||
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
|
||||
import { usePopUp } from "@app/hooks";
|
||||
import { useDeleteSshCertTemplate } from "@app/hooks/api";
|
||||
|
||||
@@ -52,7 +52,7 @@ export const SshCertificateTemplatesSection = ({ caId }: Props) => {
|
||||
<div className="flex items-center justify-between border-b border-mineshaft-400 pb-4">
|
||||
<h3 className="text-lg font-semibold text-mineshaft-100">Certificate Templates</h3>
|
||||
<OrgPermissionCan
|
||||
I={OrgPermissionSshCertificateTemplateActions.Create}
|
||||
I={OrgPermissionActions.Create}
|
||||
a={OrgPermissionSubjects.SshCertificateTemplates}
|
||||
>
|
||||
{(isAllowed) => (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { faCertificate,faEllipsis, faFileAlt, faTrash } from "@fortawesome/free-solid-svg-icons";
|
||||
import { faCertificate, faEllipsis, faFileAlt, faTrash } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
Tooltip,
|
||||
Tr
|
||||
} from "@app/components/v2";
|
||||
import { OrgPermissionSshCertificateTemplateActions, OrgPermissionSubjects } from "@app/context";
|
||||
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
|
||||
import { useGetSshCaCertTemplates } from "@app/hooks/api";
|
||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||
|
||||
@@ -69,7 +69,7 @@ export const SshCertificateTemplatesTable = ({ handlePopUpOpen, sshCaId }: Props
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" className="p-1">
|
||||
<OrgPermissionCan
|
||||
I={OrgPermissionSshCertificateTemplateActions.Edit}
|
||||
I={OrgPermissionActions.Edit}
|
||||
a={OrgPermissionSubjects.SshCertificateTemplates}
|
||||
>
|
||||
<DropdownMenuItem
|
||||
@@ -87,7 +87,7 @@ export const SshCertificateTemplatesTable = ({ handlePopUpOpen, sshCaId }: Props
|
||||
</DropdownMenuItem>
|
||||
</OrgPermissionCan>
|
||||
<OrgPermissionCan
|
||||
I={OrgPermissionSshCertificateTemplateActions.Edit}
|
||||
I={OrgPermissionActions.Edit}
|
||||
a={OrgPermissionSubjects.SshCertificateTemplates}
|
||||
>
|
||||
<DropdownMenuItem
|
||||
@@ -102,7 +102,7 @@ export const SshCertificateTemplatesTable = ({ handlePopUpOpen, sshCaId }: Props
|
||||
</DropdownMenuItem>
|
||||
</OrgPermissionCan>
|
||||
<OrgPermissionCan
|
||||
I={OrgPermissionSshCertificateTemplateActions.Delete}
|
||||
I={OrgPermissionActions.Delete}
|
||||
a={OrgPermissionSubjects.SshCertificateTemplates}
|
||||
>
|
||||
{(isAllowed) => (
|
||||
|
||||
@@ -11,7 +11,8 @@ import {
|
||||
Td,
|
||||
Th,
|
||||
THead,
|
||||
Tr} from "@app/components/v2";
|
||||
Tr
|
||||
} from "@app/components/v2";
|
||||
import { useOrganization } from "@app/context";
|
||||
import { useListOrgSshCertificates } from "@app/hooks/api";
|
||||
import { sshCertTypeToNameMap } from "@app/hooks/api/ssh-ca/constants";
|
||||
@@ -29,6 +30,8 @@ export const SshCertificatesTable = () => {
|
||||
limit: perPage
|
||||
});
|
||||
|
||||
console.log("SSH Certificates Table data: ", data);
|
||||
|
||||
return (
|
||||
<TableContainer>
|
||||
<Table>
|
||||
|
||||
Reference in New Issue
Block a user