![]() |
Hi
I want to make an admin panel like Users managment ( list/add/edit/update/delete ) and same for Groups and Permissions. As i saw from Shield docs there is no solution for this, only assign groups and permission from Shield functions. Shield\Config\AuthGroups config class PHP Code: public array $groups = [ PHP Code: public array $permissions = [ Is that means if i don't use config based permission and groups i cannot use a Shield and hes functions to check if user have permission to access controller/method ?
I do not know Shield, but you can use the constructor in the configs and call something DB::getGroups()/File::readGroups() to update the $this->groups. No, it's dangerous.
You can use the settings service to save your changes in the database.
Settings
In place of the CodeIgniter config() helper, Shield uses the official Settings library. This provides a way to save any Config class values to the database if you want to modify them, but falls back on the standard Config class if nothing is found in the database. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(03-13-2025, 09:23 AM)InsiteFX Wrote: Settings Ok i managed to install Settings library from here https://github.com/codeigniter4/settings...me-ov-file and managed to add setting to database using service. Values are saved in database like array same as in config AuthGroups. PHP Code: service('settings')->set('AuthGroups.permissions', $permissions); To get values or update value i know i can use database query builder or update through service. Now my question is do i check for permissions and groups like i did before PHP Code: if (auth()->user()->inGroup('admin', 'superadmin')) This is and image from database table settings ![]()
|
Welcome Guest, Not a member yet? Register Sign In |