Reformat all project files to use the prettier config file.
This commit is contained in:
@@ -1,76 +1,76 @@
|
||||
const ret = {
|
||||
"accounting:payables": 1,
|
||||
"accounting:payments": 1,
|
||||
"accounting:receivables": 1,
|
||||
"accounting:exportlogs": 3,
|
||||
"accounting:payables": 1,
|
||||
"accounting:payments": 1,
|
||||
"accounting:receivables": 1,
|
||||
"accounting:exportlogs": 3,
|
||||
|
||||
"csi:page": 6,
|
||||
"csi:export": 5,
|
||||
"csi:page": 6,
|
||||
"csi:export": 5,
|
||||
|
||||
"contracts:create": 2,
|
||||
"contracts:detail": 2,
|
||||
"contracts:list": 2,
|
||||
"contracts:create": 2,
|
||||
"contracts:detail": 2,
|
||||
"contracts:list": 2,
|
||||
|
||||
"courtesycar:create": 2,
|
||||
"courtesycar:detail": 2,
|
||||
"courtesycar:list": 2,
|
||||
"courtesycar:create": 2,
|
||||
"courtesycar:detail": 2,
|
||||
"courtesycar:list": 2,
|
||||
|
||||
"jobs:admin": 5,
|
||||
"jobs:list-active": 1,
|
||||
"jobs:list-all": 2,
|
||||
"jobs:available-list": 2,
|
||||
"jobs:create": 1,
|
||||
"jobs:intake": 1,
|
||||
"jobs:close": 5,
|
||||
"jobs:detail": 1,
|
||||
"jobs:partsqueue": 4,
|
||||
"jobs:checklist-view": 2,
|
||||
"jobs:list-ready": 1,
|
||||
"jobs:void": 5,
|
||||
"jobs:admin": 5,
|
||||
"jobs:list-active": 1,
|
||||
"jobs:list-all": 2,
|
||||
"jobs:available-list": 2,
|
||||
"jobs:create": 1,
|
||||
"jobs:intake": 1,
|
||||
"jobs:close": 5,
|
||||
"jobs:detail": 1,
|
||||
"jobs:partsqueue": 4,
|
||||
"jobs:checklist-view": 2,
|
||||
"jobs:list-ready": 1,
|
||||
"jobs:void": 5,
|
||||
|
||||
"bills:enter": 2,
|
||||
"bills:view": 2,
|
||||
"bills:list": 2,
|
||||
"bills:delete": 3,
|
||||
"bills:reexport": 3,
|
||||
"bills:enter": 2,
|
||||
"bills:view": 2,
|
||||
"bills:list": 2,
|
||||
"bills:delete": 3,
|
||||
"bills:reexport": 3,
|
||||
|
||||
"employees:page": 5,
|
||||
"employees:page": 5,
|
||||
|
||||
"owners:list": 2,
|
||||
"owners:detail": 3,
|
||||
"owners:list": 2,
|
||||
"owners:detail": 3,
|
||||
|
||||
"payments:enter": 3,
|
||||
"payments:list": 3,
|
||||
"payments:enter": 3,
|
||||
"payments:list": 3,
|
||||
|
||||
"phonebook:view": 1,
|
||||
"phonebook:edit": 2,
|
||||
"phonebook:view": 1,
|
||||
"phonebook:edit": 2,
|
||||
|
||||
"production:board": 1,
|
||||
"production:list": 1,
|
||||
"production:board": 1,
|
||||
"production:list": 1,
|
||||
|
||||
"schedule:view": 2,
|
||||
"schedule:view": 2,
|
||||
|
||||
"scoreboard:view": 3,
|
||||
"scoreboard:view": 3,
|
||||
|
||||
"shiftclock:view": 2,
|
||||
"shiftclock:view": 2,
|
||||
|
||||
"shop:config": 4,
|
||||
"shop:dashboard": 3,
|
||||
"shop:rbac": 5,
|
||||
"shop:reportcenter": 2,
|
||||
"shop:templates": 4,
|
||||
"shop:vendors": 2,
|
||||
"shop:config": 4,
|
||||
"shop:dashboard": 3,
|
||||
"shop:rbac": 5,
|
||||
"shop:reportcenter": 2,
|
||||
"shop:templates": 4,
|
||||
"shop:vendors": 2,
|
||||
|
||||
"temporarydocs:view": 2,
|
||||
"temporarydocs:view": 2,
|
||||
|
||||
"timetickets:enter": 3,
|
||||
"timetickets:list": 3,
|
||||
"timetickets:edit": 4,
|
||||
"timetickets:shiftedit": 5,
|
||||
"timetickets:enter": 3,
|
||||
"timetickets:list": 3,
|
||||
"timetickets:edit": 4,
|
||||
"timetickets:shiftedit": 5,
|
||||
|
||||
"users:editaccess": 4,
|
||||
"users:editaccess": 4,
|
||||
|
||||
"inventory:list": 1,
|
||||
"inventory:delete": 2,
|
||||
"inventory:list": 1,
|
||||
"inventory:delete": 2
|
||||
};
|
||||
export default ret;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user