Which operating systems have you tested for this bug?
macOS
Which server did you use?
apache
Database
MySQL 5.7.39
Did you customize Shield?
No
What happened?
Can't get the authGroups permissions defined in the /modules/Auth/Config/AuthGroups.
when i request a list of permissions using setting('AuthGroups.permissions'), i expected all the permissions array but i get default permission array defined in AuthGroup.
public array $permissions = [
'admin.access' => 'Can access the sites admin area',
'admin.settings' => 'Can access the main site settings',
'users.manage-admins' => 'Can manage other admins',
'users.create' => 'Can create new non-admin users',
'users.edit' => 'Can edit existing non-admin users',
'users.delete' => 'Can delete existing non-admin users',
'beta.access' => 'Can access beta-level features',
];
Steps to Reproduce
I am using codeigniter4/shield as Auth modules.
I have /modules/Auth/Config/AuthGroups with some of dummy permission. this is the core config for my all base auth group configuration.
namespace Modules\Auth\Config;
// other stuffs
use CodeIgniter\Shield\Config\AuthGroups as ShieldAuthGroups;
class AuthGroups extends ShieldAuthGroups
{
// other stuffs
public array $permissions = [
'admin.access' => 'Can access the sites admin area',
'admin.settings' => 'Can access the main site settings',
'groups.settings' => 'Can access the groups settings',
'groups.edit' => 'Can edit existing user groups',
'users.list' => 'Can view a list of users in the system',
'users.manage-admins' => 'Can manage other admins',
'users.view' => 'Can view user details',
'users.create' => 'Can create new non-admin users',
'users.edit' => 'Can edit existing non-admin users',
'users.delete' => 'Can delete existing non-admin users',
'users.settings' => 'Can manage User settings in admin area',
'beta.access' => 'Can access beta-level features',
'site.viewOffline' => 'Can view the site even when in "offline" mode',
'widgets.settings' => 'Can view the settings for site Widgets',
'consent.settings' => 'Can view the settings for the Consent module',
'recycler.view' => 'Can view the Recycler area',
'logs.view' => 'Can view the logs',
'logs.manage' => 'Can manage the logs',
'me.edit' => 'Can edit user\'s own settings',
'me.security' => 'Can change user\'s own password',
];
// other stuffs
}
i have another config class called /modules/Languages/Config/AuthGroups. this is the auth group config where i only defined the language modules related auth group & permissions.
namespace Modules\Languages\Config;
// other stuffs
use Modules\Auth\Config\AuthGroups as ConfigAuthGroups;
class AuthGroups extends ConfigAuthGroups
{
protected array $permissions = [
'languages.access' => 'Can access the Languages Files Management Module',
'languages.view' => 'Can view all language files',
'languages.view_single' => 'Can view individual language files',
'languages.create' => 'Can create new language files',
'languages.edit' => 'Can edit existing language files',
'languages.edit_content' => 'Can edit translations within a language file',
'languages.edit_meta' => 'Can edit metadata of a language file (e.g., name, locale)',
'languages.delete' => 'Can delete language files',
'languages.manage' => 'Can manage all aspects of language files (create, edit, delete)',
'languages.upload' => 'Can upload language files',
'languages.download' => 'Can download language files',
'languages.import' => 'Can import translations from an external source',
'languages.export' => 'Can export translations to an external source',
'languages.approve' => 'Can approve or reject changes made to a language file (for workflows)',
];
}
Steps
Setup the codeigniter 4 app starter using composer.
Installed codeigniter shield v1.0.2.
After successfully performing the installation process of "CodeIgniter Shield", create a directory named Config inside /modules/Auth/Config in the project root. Move all auth config related files to this folder. Update everything necessary including namespaces and all.
add newly created namespace to app/Config/Autoload.php:
Define base permissions to /modules/Auth/Config/AuthGroups with:
namespace Modules\Auth\Config;
// other stuffs
use CodeIgniter\Shield\Config\AuthGroups as ShieldAuthGroups;
class AuthGroups extends ShieldAuthGroups
{
// other stuffs
public array $permissions = [
'admin.access' => 'Can access the sites admin area',
'admin.settings' => 'Can access the main site settings',
'groups.settings' => 'Can access the groups settings',
'groups.edit' => 'Can edit existing user groups',
'users.list' => 'Can view a list of users in the system',
'users.manage-admins' => 'Can manage other admins',
'users.view' => 'Can view user details',
'users.create' => 'Can create new non-admin users',
'users.edit' => 'Can edit existing non-admin users',
'users.delete' => 'Can delete existing non-admin users',
'users.settings' => 'Can manage User settings in admin area',
'beta.access' => 'Can access beta-level features',
'site.viewOffline' => 'Can view the site even when in "offline" mode',
'widgets.settings' => 'Can view the settings for site Widgets',
'consent.settings' => 'Can view the settings for the Consent module',
'recycler.view' => 'Can view the Recycler area',
'logs.view' => 'Can view the logs',
'logs.manage' => 'Can manage the logs',
'me.edit' => 'Can edit user\'s own settings',
'me.security' => 'Can change user\'s own password',
];
// other stuffs
}
the methodology is inspired by [Bonfire 2 Auth Module](https://github.com/lonnieezell/Bonfire2/blob/develop/src/Auth/Config/AuthGroups.php)
### Expected Output
```php
[
'admin.access' => 'Can access the sites admin area',
'admin.settings' => 'Can access the main site settings',
'groups.settings' => 'Can access the groups settings',
'groups.edit' => 'Can edit existing user groups',
'users.list' => 'Can view a list of users in the system',
'users.manage-admins' => 'Can manage other admins',
'users.view' => 'Can view user details',
'users.create' => 'Can create new non-admin users',
'users.edit' => 'Can edit existing non-admin users',
'users.delete' => 'Can delete existing non-admin users',
'users.settings' => 'Can manage User settings in admin area',
'beta.access' => 'Can access beta-level features',
'site.viewOffline' => 'Can view the site even when in "offline" mode',
'widgets.settings' => 'Can view the settings for site Widgets',
'consent.settings' => 'Can view the settings for the Consent module',
'recycler.view' => 'Can view the Recycler area',
'logs.view' => 'Can view the logs',
'logs.manage' => 'Can manage the logs',
'me.edit' => 'Can edit user\'s own settings',
'me.security' => 'Can change user\'s own password',
'languages.access' => 'Can access the Languages Files Management Module',
'languages.view' => 'Can view all language files',
'languages.view_single' => 'Can view individual language files',
'languages.create' => 'Can create new language files',
'languages.edit' => 'Can edit existing language files',
'languages.edit_content' => 'Can edit translations within a language file',
'languages.edit_meta' => 'Can edit metadata of a language file (e.g., name, locale)',
'languages.delete' => 'Can delete language files',
'languages.manage' => 'Can manage all aspects of language files (create, edit, delete)',
'languages.upload' => 'Can upload language files',
'languages.download' => 'Can download language files',
'languages.import' => 'Can import translations from an external source',
'languages.export' => 'Can export translations to an external source',
'languages.approve' => 'Can approve or reject changes made to a language file (for workflows)',
];
PHP Version
8.3.0
CodeIgniter4 Version
4.4.6
Shield Version
1.0.2
Which operating systems have you tested for this bug?
macOS
Which server did you use?
apache
Database
MySQL 5.7.39
Did you customize Shield?
No
What happened?
Can't get the authGroups permissions defined in the
/modules/Auth/Config/AuthGroups
.when i request a list of permissions using
setting('AuthGroups.permissions')
, i expected all the permissions array but i get default permission array defined in AuthGroup.Steps to Reproduce
I am using
codeigniter4/shield
as Auth modules.I have
/modules/Auth/Config/AuthGroups
with some of dummy permission. this is the core config for my all base auth group configuration.i have another config class called
/modules/Languages/Config/AuthGroups
. this is the auth group config where i only defined the language modules related auth group & permissions.Steps
/modules/Auth/Config
in the project root. Move all auth config related files to this folder. Update everything necessary including namespaces and all.app/Config/Autoload.php
:/modules/Auth/Config/AuthGroups
with:// other stuffs use CodeIgniter\Shield\Config\AuthGroups as ShieldAuthGroups;
class AuthGroups extends ShieldAuthGroups { // other stuffs public array $permissions = [ 'admin.access' => 'Can access the sites admin area', 'admin.settings' => 'Can access the main site settings', 'groups.settings' => 'Can access the groups settings', 'groups.edit' => 'Can edit existing user groups', 'users.list' => 'Can view a list of users in the system', 'users.manage-admins' => 'Can manage other admins', 'users.view' => 'Can view user details', 'users.create' => 'Can create new non-admin users', 'users.edit' => 'Can edit existing non-admin users', 'users.delete' => 'Can delete existing non-admin users', 'users.settings' => 'Can manage User settings in admin area', 'beta.access' => 'Can access beta-level features', 'site.viewOffline' => 'Can view the site even when in "offline" mode', 'widgets.settings' => 'Can view the settings for site Widgets', 'consent.settings' => 'Can view the settings for the Consent module', 'recycler.view' => 'Can view the Recycler area', 'logs.view' => 'Can view the logs', 'logs.manage' => 'Can manage the logs', 'me.edit' => 'Can edit user\'s own settings', 'me.security' => 'Can change user\'s own password', ]; // other stuffs }
Anything else?