RBAC Changes for Inv Delete IO-559

This commit is contained in:
Patrick Fic
2021-01-21 16:09:15 -08:00
parent 3836750fb3
commit cc82d55508
8 changed files with 44 additions and 4 deletions

View File

@@ -3434,6 +3434,27 @@
<folder_node>
<name>bills</name>
<children>
<concept_node>
<name>delete</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>enter</name>
<definition_loaded>false</definition_loaded>

View File

@@ -3,6 +3,7 @@ import { Button, notification } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { DELETE_BILL } from "../../graphql/bills.queries";
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
export default function BillDeleteButton({ bill }) {
const [loading, setLoading] = useState(false);
@@ -45,8 +46,10 @@ export default function BillDeleteButton({ bill }) {
};
return (
<Button disabled={bill.exported} onClick={handleDelete} loading={loading}>
{t("general.actions.delete")}
</Button>
<RbacWrapper action="bills:delete" noauth={<></>}>
<Button disabled={bill.exported} onClick={handleDelete} loading={loading}>
{t("general.actions.delete")}
</Button>
</RbacWrapper>
);
}

View File

@@ -27,6 +27,7 @@ const ret = {
"bills:enter": 2,
"bills:view": 2,
"bills:list": 2,
"bills:delete": 3,
"employees:page": 5,

View File

@@ -272,6 +272,18 @@ export default function ShopInfoRbacComponent({ form }) {
>
<InputNumber />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.rbac.bills.delete")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
name={["md_rbac", "bills:delete"]}
>
<InputNumber />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.rbac.bills.view")}
rules={[

View File

@@ -155,7 +155,7 @@ export const UPDATE_SHOP = gql`
first_name
last_name
employee_number
cost_center
rates
}
}
}

View File

@@ -226,6 +226,7 @@
"receivables": "Accounting -> Receivables"
},
"bills": {
"delete": "Bills -> Delete",
"enter": "Bills -> Enter",
"list": "Bills -> List",
"view": "Bills -> View"

View File

@@ -226,6 +226,7 @@
"receivables": ""
},
"bills": {
"delete": "",
"enter": "",
"list": "",
"view": ""

View File

@@ -226,6 +226,7 @@
"receivables": ""
},
"bills": {
"delete": "",
"enter": "",
"list": "",
"view": ""