Tuni-Soft Posted March 16, 2021 Share Posted March 16, 2021 (edited) Hi, I'm setting up a module demo and I want to only enable the Configure button Is there a way to do it? I tried to to it using the permissions but no luck When I remove the Edit permission from the module, the configure button is removed altogether Any help is much appreciated Thanks Edited March 16, 2021 by Tuni-Soft (see edit history) Link to comment Share on other sites More sharing options...
Tuni-Soft Posted March 16, 2021 Author Share Posted March 16, 2021 (edited) I solved it by modifying this method directly // /src/Adapter/Module/AdminModuleDataProvider.php public function isAllowedAccess($action, $name = '') { if (Tools::isPHPCLI()) { return true; } if (in_array($action, ['install', 'upgrade'])) { return $this->employee->can('add', 'AdminModulessf'); } if ('uninstall' === $action) { return $this->employee->can('delete', 'AdminModulessf') && $this->moduleProvider->can('uninstall', $name); } // add this statement if (in_array($action, array('enable', 'disable', 'enable_mobile', 'disable_mobile', 'reset'))) { return $this->employee->isSuperAdmin(); } return $this->employee->can('edit', 'AdminModulessf') && $this->moduleProvider->can('configure', $name); } or like this public function isAllowedAccess($action, $name = '') { if (Tools::isPHPCLI()) { return true; } if (in_array($action, ['install', 'upgrade', 'enable', 'enable_mobile'])) { return $this->employee->can('add', 'AdminModulessf'); } if (in_array($action, ['uninstall', 'reset', 'disable', 'disable_mobile'])) { return $this->employee->can('delete', 'AdminModulessf') && $this->moduleProvider->can('uninstall', $name); } return $this->employee->can('edit', 'AdminModulessf') && $this->moduleProvider->can('configure', $name); } Edited March 16, 2021 by Tuni-Soft (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now