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