Hiding write key and secret if the user is no admin
This commit is contained in:
parent
d93eb2c987
commit
48191cb7a0
|
@ -5,6 +5,8 @@ import axiosConfig from "../../../config/axiosConfig";
|
|||
import { I_Folder, I_Installation } from "../../../util/types";
|
||||
import InstallationForm from "./InstallationForm";
|
||||
import MoveDialog from "../../Groups/Detail/MoveDialog";
|
||||
import {useContext} from "react";
|
||||
import {UserContext} from "../../Context/UserContextProvider";
|
||||
|
||||
interface I_InstallationProps {
|
||||
loading?: boolean;
|
||||
|
@ -17,6 +19,7 @@ const Installation = (props: I_InstallationProps) => {
|
|||
const { values, loading, error } = props;
|
||||
const { id } = useParams();
|
||||
const theme = useTheme();
|
||||
const { getCurrentUser } = useContext(UserContext);
|
||||
|
||||
const handleSubmit = (data: I_Folder, formikValues: Partial<I_Folder>) => {
|
||||
return axiosConfig.put("/UpdateInstallation", { ...data, ...formikValues });
|
||||
|
@ -45,11 +48,9 @@ const Installation = (props: I_InstallationProps) => {
|
|||
handleSubmit={handleSubmit}
|
||||
additionalButtons={props.hasMoveButton ? [moveDialog] : undefined}
|
||||
/>
|
||||
<Box>
|
||||
{values.s3WriteKey && <div>{`Write key: ${values.s3WriteKey}`}</div>}
|
||||
{values.s3WriteSecret && (
|
||||
<div>{`Write secret: ${values.s3WriteSecret}`}</div>
|
||||
)}
|
||||
<Box hidden={!getCurrentUser().hasWriteAccess}>
|
||||
{<div>{`Write key: ${getCurrentUser().hasWriteAccess ? values.s3WriteKey : ""}`}</div>}
|
||||
{<div>{`Write secret: ${getCurrentUser().hasWriteAccess ? values.s3WriteSecret : ""}`}</div>}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue