diff --git a/controllers/BaseController.php b/controllers/BaseController.php index 0de7c51f..d4a6d4f3 100644 --- a/controllers/BaseController.php +++ b/controllers/BaseController.php @@ -2,6 +2,7 @@ namespace Grocy\Controllers; +use Grocy\Controllers\Users\User; use \Grocy\Services\DatabaseService; use \Grocy\Services\ApplicationService; use \Grocy\Services\LocalizationService; @@ -66,6 +67,8 @@ class BaseController } $this->View->set('featureFlags', $constants); + $this->View->set('permissions', User::PermissionList()); + return $this->View->render($response, $page, $data); } diff --git a/public/css/grocy.css b/public/css/grocy.css index 295aea0b..e259138f 100644 --- a/public/css/grocy.css +++ b/public/css/grocy.css @@ -581,3 +581,7 @@ canvas.drawingBuffer { } } +.not-allowed { + pointer-events: none; + opacity: 0.5; +} \ No newline at end of file diff --git a/public/js/grocy.js b/public/js/grocy.js index 275cd6fe..ed73d677 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -662,3 +662,11 @@ $.extend(true, $.fn.dataTable.defaults, { }); } }); + +$(Grocy.Permissions).each(function (index, item) +{ + if(item.has_permission == 0) + { + $('.permission-'+item.permission_name).addClass('disabled').addClass('not-allowed'); + } +}); diff --git a/views/batteries.blade.php b/views/batteries.blade.php index 9926c37d..8d2a1239 100644 --- a/views/batteries.blade.php +++ b/views/batteries.blade.php @@ -20,7 +20,7 @@