From fcc5bf8c30aff1e3cde48d827ddfc7790efe0e81 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 10 Aug 2021 16:53:20 +1000 Subject: [PATCH] Check that the user has the required permisions --- lib/widget/category_display.dart | 34 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/widget/category_display.dart b/lib/widget/category_display.dart index 8cac11f7..e4233bc8 100644 --- a/lib/widget/category_display.dart +++ b/lib/widget/category_display.dart @@ -273,26 +273,28 @@ class _CategoryDisplayState extends RefreshableState { getCategoryDescriptionCard(extra: false), ]; - tiles.add( - ListTile( - title: Text(L10().categoryCreate), - subtitle: Text(L10().categoryCreateDetail), - leading: FaIcon(FontAwesomeIcons.sitemap, color: COLOR_CLICK), - onTap: () async { - _newCategory(context); - }, - ) - ); - - if (category != null) { + if (InvenTreeAPI().checkPermission('part', 'add')) { tiles.add( ListTile( - title: Text(L10().partCreate), - subtitle: Text(L10().partCreateDetail), - leading: FaIcon(FontAwesomeIcons.shapes, color: COLOR_CLICK), - onTap: _newPart, + title: Text(L10().categoryCreate), + subtitle: Text(L10().categoryCreateDetail), + leading: FaIcon(FontAwesomeIcons.sitemap, color: COLOR_CLICK), + onTap: () async { + _newCategory(context); + }, ) ); + + if (category != null) { + tiles.add( + ListTile( + title: Text(L10().partCreate), + subtitle: Text(L10().partCreateDetail), + leading: FaIcon(FontAwesomeIcons.shapes, color: COLOR_CLICK), + onTap: _newPart, + ) + ); + } } return tiles;