IO-772 RBAC for RBAC Controls
This commit is contained in:
@@ -48,7 +48,7 @@ const ret = {
|
|||||||
"shiftclock:view": 2,
|
"shiftclock:view": 2,
|
||||||
|
|
||||||
"shop:vendors": 2,
|
"shop:vendors": 2,
|
||||||
"shop:rbac": 5,
|
"shop:rbac": 1,
|
||||||
"shop:templates": 4,
|
"shop:templates": 4,
|
||||||
|
|
||||||
"temporarydocs:view": 2,
|
"temporarydocs:view": 2,
|
||||||
|
|||||||
@@ -28,10 +28,18 @@ function RbacWrapper({
|
|||||||
...restProps
|
...restProps
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"********object :>> ",
|
||||||
|
action,
|
||||||
|
rbacDefaults[action],
|
||||||
|
bodyshop.md_rbac[action]
|
||||||
|
);
|
||||||
if (
|
if (
|
||||||
(requiredAuthLevel && requiredAuthLevel <= authLevel) ||
|
(requiredAuthLevel && requiredAuthLevel <= authLevel) ||
|
||||||
(bodyshop.md_rbac && bodyshop.md_rbac[action] <= authLevel) ||
|
((bodyshop.md_rbac && bodyshop.md_rbac[action]) || rbacDefaults[action]) <=
|
||||||
(!!!bodyshop.md_rbac && rbacDefaults[action] <= authLevel)
|
authLevel ||
|
||||||
|
(!bodyshop.md_rbac && rbacDefaults[action] <= authLevel)
|
||||||
)
|
)
|
||||||
return <div>{React.cloneElement(children, restProps)}</div>;
|
return <div>{React.cloneElement(children, restProps)}</div>;
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ import { Form, InputNumber } from "antd";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
|
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
||||||
export default function ShopInfoRbacComponent({ form }) {
|
export default function ShopInfoRbacComponent({ form }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<RbacWrapper action="shop:rbac">
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.accounting.payables")}
|
label={t("bodyshop.fields.rbac.accounting.payables")}
|
||||||
@@ -537,6 +538,6 @@ export default function ShopInfoRbacComponent({ form }) {
|
|||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
</div>
|
</RbacWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user