mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix permission checks for bulk delete actions (#7796)
This commit is contained in:
parent
6fd5a9941b
commit
85fc709fc7
@ -554,7 +554,7 @@ export function BomTable({
|
||||
modelField: 'sub_part',
|
||||
rowActions: rowActions,
|
||||
enableSelection: !partLocked,
|
||||
enableBulkDelete: !partLocked,
|
||||
enableBulkDelete: !partLocked && user.hasDeleteRole(UserRoles.part),
|
||||
enableDownload: true
|
||||
}}
|
||||
/>
|
||||
|
@ -154,7 +154,7 @@ export default function BuildAllocatedStockTable({
|
||||
stock_detail: true,
|
||||
supplier_detail: true
|
||||
},
|
||||
enableBulkDelete: true,
|
||||
enableBulkDelete: user.hasDeleteRole(UserRoles.build),
|
||||
enableDownload: true,
|
||||
enableSelection: true,
|
||||
rowActions: rowActions,
|
||||
|
@ -8,6 +8,7 @@ import { ApiEndpoints } from '../../enums/ApiEndpoints';
|
||||
import { useDeleteApiFormModal } from '../../hooks/UseForm';
|
||||
import { useTable } from '../../hooks/UseTable';
|
||||
import { apiUrl } from '../../states/ApiState';
|
||||
import { useUserState } from '../../states/UserState';
|
||||
import { TableColumn } from '../Column';
|
||||
import { InvenTreeTable } from '../InvenTreeTable';
|
||||
import { RowAction, RowDeleteAction } from '../RowActions';
|
||||
@ -17,6 +18,7 @@ import { RowAction, RowDeleteAction } from '../RowActions';
|
||||
*/
|
||||
export default function ErrorReportTable() {
|
||||
const table = useTable('error-report');
|
||||
const user = useUserState();
|
||||
|
||||
const [error, setError] = useState<string>('');
|
||||
|
||||
@ -90,7 +92,7 @@ export default function ErrorReportTable() {
|
||||
tableState={table}
|
||||
columns={columns}
|
||||
props={{
|
||||
enableBulkDelete: true,
|
||||
enableBulkDelete: user.isStaff(),
|
||||
enableSelection: true,
|
||||
rowActions: rowActions,
|
||||
onRowClick: (row) => {
|
||||
|
@ -7,11 +7,13 @@ import { StylishText } from '../../components/items/StylishText';
|
||||
import { ApiEndpoints } from '../../enums/ApiEndpoints';
|
||||
import { useTable } from '../../hooks/UseTable';
|
||||
import { apiUrl } from '../../states/ApiState';
|
||||
import { useUserState } from '../../states/UserState';
|
||||
import { TableColumn } from '../Column';
|
||||
import { InvenTreeTable } from '../InvenTreeTable';
|
||||
|
||||
export default function FailedTasksTable() {
|
||||
const table = useTable('tasks-failed');
|
||||
const user = useUserState();
|
||||
|
||||
const [error, setError] = useState<string>('');
|
||||
|
||||
@ -70,7 +72,7 @@ export default function FailedTasksTable() {
|
||||
tableState={table}
|
||||
columns={columns}
|
||||
props={{
|
||||
enableBulkDelete: true,
|
||||
enableBulkDelete: user.isStaff(),
|
||||
enableSelection: true,
|
||||
onRowClick: (row: any) => {
|
||||
setError(row.result);
|
||||
|
@ -4,11 +4,13 @@ import { useMemo } from 'react';
|
||||
import { ApiEndpoints } from '../../enums/ApiEndpoints';
|
||||
import { useTable } from '../../hooks/UseTable';
|
||||
import { apiUrl } from '../../states/ApiState';
|
||||
import { useUserState } from '../../states/UserState';
|
||||
import { TableColumn } from '../Column';
|
||||
import { InvenTreeTable } from '../InvenTreeTable';
|
||||
|
||||
export default function PendingTasksTable() {
|
||||
const table = useTable('tasks-pending');
|
||||
const user = useUserState();
|
||||
|
||||
const columns: TableColumn[] = useMemo(() => {
|
||||
return [
|
||||
@ -48,7 +50,7 @@ export default function PendingTasksTable() {
|
||||
tableState={table}
|
||||
columns={columns}
|
||||
props={{
|
||||
enableBulkDelete: true,
|
||||
enableBulkDelete: user.isStaff(),
|
||||
enableSelection: true
|
||||
}}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user