mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-14 12:06:24 +00:00
Hide actions if user does not have correct permissions
This commit is contained in:
parent
04f03188e2
commit
096c4e86dc
4 changed files with 74 additions and 36 deletions
|
|
@ -140,10 +140,9 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||
|
||||
void _stockUpdateMessage(bool result) {
|
||||
|
||||
showSnackIcon(
|
||||
result ? "Stock item updated" : "Stock item updated failed",
|
||||
success: result
|
||||
);
|
||||
if (result) {
|
||||
showSnackIcon("Stock item updated", success: true);
|
||||
}
|
||||
}
|
||||
|
||||
void _removeStock() async {
|
||||
|
|
@ -514,6 +513,24 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||
|
||||
tiles.add(headerTile());
|
||||
|
||||
// First check that the user has the required permissions to adjust stock
|
||||
if (!InvenTreeAPI().checkPermission('stock', 'change')) {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text("Permission Required"),
|
||||
leading: FaIcon(FontAwesomeIcons.userTimes)
|
||||
)
|
||||
);
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
subtitle: Text("Your account does not have permission to perform stock adjustments"),
|
||||
)
|
||||
);
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
||||
if (!item.isSerialized()) {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue