Configuration
Most options change at runtime from the panel's Settings screen and need no file at all. The rest live in the config class RoleWarden\Config\RoleWarden, which you never edit: override a value in .env, or extend the class in your application.
Overriding a value
In .env, with the rolewarden. prefix:
rolewarden.tablePrefix = 'myapp_'
rolewarden.lockAttempts = 8
Or in app/Config/RoleWarden.php, for values that are not plain text or numbers:
<?php
namespace Config;
class RoleWarden extends \RoleWarden\Config\RoleWarden
{
public array $extraThemes = ['ocean' => 'Ocean'];
public ?string $themeStylesheet = '/css/rolewarden-theme.css';
}
Options
| Option | Default | What it does |
|---|---|---|
tablePrefix | 'acl_' | Prefix of every table the module creates. Set it before running the migrations. |
defaultRole | null | Slug of the role given to every new user, registered through Shield or created from the panel. Starting value: the Settings screen changes it. A super admin role is refused. |
sessionLifetime | 7200 | Seconds a signed-in session may stay idle. Starting value of the Settings screen. |
lockAttempts | 5 | Failed sign-ins on one email, since its last successful one, that lock it. |
lockMinutes | 15 | How long a locked email waits. |
signInRate | 10 | Sign-in attempts accepted per minute from one IP address, whatever the email. |
activityRetentionDays | 365 | Days the activity log keeps its entries; 0 keeps them forever. The Settings screen offers 90 days, 1 year or forever. |
colorScheme | 'system' | Light or dark for a user who has not chosen; 'system' follows the browser. |
languages | [] | Languages the panel offers, for example ['en']; empty offers every language it has a file for. See Languages. |
extraThemes | [] | Themes of your application offered next to Console, Clarity and Contrast: slug => label. See Themes. |
themeStylesheet | null | URL of a stylesheet of your application loaded after the panel's own. |
The Settings screen
/rolewarden/settings needs settings.view to open and settings.update to save. Values are stored with CodeIgniter's Settings library, in the settings table Shield already uses, and apply from each user's next request.
- Default role for new users.
- Session lifetime and Remember me. "Remember me" is Shield's own
Auth.sessionConfig, stored through the same library, so Shield reads it unchanged. Off hides the option on the sign-in page. - Lock after failed sign-ins, lock duration and sign-in attempts per address.
- How long the activity log is kept. Older entries are deleted once a day, on the first write of the day: no cron job.
Sign-in limits and Shield
- The lock counts the failures Shield records in
auth_logins. KeepConfig\Auth::$recordLoginAttemptat its default, or at least recording failures. - The limits run in the
rw-signinfilter, which the module puts on theloginroute by itself. If you moved Shield's login route, addrw-signinto its path inapp/Config/Filters.php. - Shield's
auth-ratesfilter, if you use it, still caps every IP at 10 requests a minute: remove it to let the setting go higher.
Security emails
The module emails a user when their account signs in from a device or address it has never used (not on the very first sign-in), when their password changes, from the profile or set by an administrator, and when their email reaches the sign-in lock. That last alert also goes to everyone holding security.alerts, once per lock.
- They use CodeIgniter's Email service and
app/Config/Email.php, which needs afromEmail; without one they are skipped and a warning is logged. - They are sent after the response has gone out, so no page waits for the mail server.
- Each one goes out in the language of the person who receives it.
- To put them on a queue of your own, see the
rolewarden.mailevent in the API reference.
Permissions the panel uses
| Permission | Allows |
|---|---|
users.view, users.create, users.update, users.delete, users.activate | The users list and detail, creating, editing, deleting, deactivating users |
users.import | The CSV import |
roles.view, roles.create, roles.update, roles.delete, roles.assign | Roles, their permission matrix, assigning roles to users |
permissions.view, permissions.override | The permission list, per-user overrides |
settings.view, settings.update | The Settings screen |
sessions.view, sessions.revoke | Another user's sessions on their detail page |
activity.view | The activity log |
appearance.update | The theme for everyone |
security.alerts | Receiving the "too many failed sign-ins" alerts about other accounts |
The system role admin holds them all; super-admin passes every check; user holds none. Profile, own sessions, language and light or dark need no permission, only being signed in.