Reformat all project files to use the prettier config file.

This commit is contained in:
Patrick Fic
2024-03-27 15:35:07 -07:00
parent b161530381
commit e1df64d592
873 changed files with 111387 additions and 125473 deletions

View File

@@ -1,63 +1,36 @@
import React from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectAuthLevel, selectBodyshop,} from "../../redux/user/user.selectors";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectAuthLevel, selectBodyshop } from "../../redux/user/user.selectors";
import AlertComponent from "../alert/alert.component";
import rbacDefaults from "./rbac-defaults";
const mapStateToProps = createStructuredSelector({
authLevel: selectAuthLevel,
bodyshop: selectBodyshop,
authLevel: selectAuthLevel,
bodyshop: selectBodyshop
});
function RbacWrapper({
authLevel,
bodyshop,
requiredAuthLevel,
noauth,
children,
action,
dispatch,
...restProps
}) {
const {t} = useTranslation();
function RbacWrapper({ authLevel, bodyshop, requiredAuthLevel, noauth, children, action, dispatch, ...restProps }) {
const { t } = useTranslation();
if (
(requiredAuthLevel && requiredAuthLevel <= authLevel) ||
((bodyshop.md_rbac && bodyshop.md_rbac[action]) || rbacDefaults[action]) <=
authLevel ||
(bodyshop.md_rbac &&
!bodyshop.md_rbac[action] &&
rbacDefaults[action] <= authLevel)
)
return children;
//return <div>{React.cloneElement(children, restProps)}</div>;
if (
(requiredAuthLevel && requiredAuthLevel <= authLevel) ||
((bodyshop.md_rbac && bodyshop.md_rbac[action]) || rbacDefaults[action]) <= authLevel ||
(bodyshop.md_rbac && !bodyshop.md_rbac[action] && rbacDefaults[action] <= authLevel)
)
return children;
//return <div>{React.cloneElement(children, restProps)}</div>;
return (
noauth || (
<AlertComponent
message={t("general.messages.rbacunauth")}
type="warning"
/>
)
);
return noauth || <AlertComponent message={t("general.messages.rbacunauth")} type="warning" />;
}
export function HasRbacAccess({
authLevel,
bodyshop,
requiredAuthLevel,
action,
}) {
return (
(requiredAuthLevel && requiredAuthLevel <= authLevel) ||
((bodyshop.md_rbac && bodyshop.md_rbac[action]) || rbacDefaults[action]) <=
authLevel ||
(bodyshop.md_rbac &&
!bodyshop.md_rbac[action] &&
rbacDefaults[action] <= authLevel)
);
export function HasRbacAccess({ authLevel, bodyshop, requiredAuthLevel, action }) {
return (
(requiredAuthLevel && requiredAuthLevel <= authLevel) ||
((bodyshop.md_rbac && bodyshop.md_rbac[action]) || rbacDefaults[action]) <= authLevel ||
(bodyshop.md_rbac && !bodyshop.md_rbac[action] && rbacDefaults[action] <= authLevel)
);
}
export default connect(mapStateToProps, null)(RbacWrapper);