mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 17:27:16 +00:00
fix: hide environments that users does not have read access too
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ type Props = {
|
|||||||
) => void;
|
) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const INIT_PER_PAGE = 10;
|
const INIT_PER_PAGE = 50;
|
||||||
|
|
||||||
export const IdentityTable = ({ handlePopUpOpen }: Props) => {
|
export const IdentityTable = ({ handlePopUpOpen }: Props) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ import { IdentityModal } from "./components/IdentityModal";
|
|||||||
import { IdentityRoleForm } from "./components/IdentityRoleForm";
|
import { IdentityRoleForm } from "./components/IdentityRoleForm";
|
||||||
|
|
||||||
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
|
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
|
||||||
const INIT_PER_PAGE = 10;
|
const INIT_PER_PAGE = 50;
|
||||||
const formatRoleName = (role: string, customRoleName?: string) => {
|
const formatRoleName = (role: string, customRoleName?: string) => {
|
||||||
if (role === ProjectMembershipRole.Custom) return customRoleName;
|
if (role === ProjectMembershipRole.Custom) return customRoleName;
|
||||||
if (role === ProjectMembershipRole.Member) return "Developer";
|
if (role === ProjectMembershipRole.Member) return "Developer";
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const LOADER_TEXT = [
|
|||||||
"Getting secret import links..."
|
"Getting secret import links..."
|
||||||
];
|
];
|
||||||
|
|
||||||
const INIT_PER_PAGE = 10;
|
const INIT_PER_PAGE = 50;
|
||||||
export const SecretMainPage = () => {
|
export const SecretMainPage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentWorkspace, isLoading: isWorkspaceLoading } = useWorkspace();
|
const { currentWorkspace, isLoading: isWorkspaceLoading } = useWorkspace();
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ enum RowType {
|
|||||||
Secret = "Secret"
|
Secret = "Secret"
|
||||||
}
|
}
|
||||||
|
|
||||||
const INIT_PER_PAGE = 10;
|
const INIT_PER_PAGE = 50;
|
||||||
|
|
||||||
export const SecretOverviewPage = () => {
|
export const SecretOverviewPage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -173,10 +173,30 @@ export const SecretOverviewPage = () => {
|
|||||||
}, [isWorkspaceLoading, workspaceId, router.isReady]);
|
}, [isWorkspaceLoading, workspaceId, router.isReady]);
|
||||||
|
|
||||||
const userAvailableEnvs = currentWorkspace?.environments || [];
|
const userAvailableEnvs = currentWorkspace?.environments || [];
|
||||||
const [visibleEnvs, setVisibleEnvs] = useState(userAvailableEnvs);
|
const [visibleEnvs, setVisibleEnvs] = useState(
|
||||||
|
userAvailableEnvs?.filter(({ slug }) =>
|
||||||
|
permission.can(
|
||||||
|
ProjectPermissionActions.Read,
|
||||||
|
subject(ProjectPermissionSub.Secrets, {
|
||||||
|
environment: slug,
|
||||||
|
secretPath
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setVisibleEnvs(userAvailableEnvs);
|
setVisibleEnvs(
|
||||||
|
userAvailableEnvs?.filter(({ slug }) =>
|
||||||
|
permission.can(
|
||||||
|
ProjectPermissionActions.Read,
|
||||||
|
subject(ProjectPermissionSub.Secrets, {
|
||||||
|
environment: slug,
|
||||||
|
secretPath
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
}, [userAvailableEnvs]);
|
}, [userAvailableEnvs]);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
+8
-5
@@ -13,7 +13,7 @@ import { twMerge } from "tailwind-merge";
|
|||||||
|
|
||||||
import { Button, Checkbox, TableContainer, Td, Tooltip, Tr } from "@app/components/v2";
|
import { Button, Checkbox, TableContainer, Td, Tooltip, Tr } from "@app/components/v2";
|
||||||
import { useToggle } from "@app/hooks";
|
import { useToggle } from "@app/hooks";
|
||||||
import { SecretType,SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
|
import { SecretType, SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
|
||||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||||
|
|
||||||
import { SecretEditRow } from "./SecretEditRow";
|
import { SecretEditRow } from "./SecretEditRow";
|
||||||
@@ -53,6 +53,8 @@ export const SecretOverviewTableRow = ({
|
|||||||
onSecretDelete,
|
onSecretDelete,
|
||||||
isImportedSecretPresentInEnv,
|
isImportedSecretPresentInEnv,
|
||||||
getImportedSecretByKey,
|
getImportedSecretByKey,
|
||||||
|
// temporary until below todo is resolved
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
expandableColWidth,
|
expandableColWidth,
|
||||||
onToggleSecretSelect,
|
onToggleSecretSelect,
|
||||||
isSelected
|
isSelected
|
||||||
@@ -150,10 +152,11 @@ export const SecretOverviewTableRow = ({
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="ml-2 p-2"
|
className="ml-2 w-[99%] p-2"
|
||||||
style={{
|
// TODO: scott expandableColWidth sometimes 0 due to parent ref not mounting, opting for relative width until resolved
|
||||||
width: `calc(${expandableColWidth}px - 1rem)`
|
// style={{
|
||||||
}}
|
// width: `calc(${expandableColWidth} - 1rem)`
|
||||||
|
// }}
|
||||||
>
|
>
|
||||||
<SecretRenameRow
|
<SecretRenameRow
|
||||||
secretKey={secretKey}
|
secretKey={secretKey}
|
||||||
|
|||||||
Reference in New Issue
Block a user