Documentation

Troubleshooting

The problems people run into most, with what causes them. Database and PHP errors are never shown on screen: look in writable/logs/ first.

Installation

The installer says "Already installed"

It found writable/rolewarden/installed.lock, or an active super admin in the database. That is on purpose: once installed, it never runs again. Sign in instead. Starting over on a test server means an empty database and deleting the lock file.

The setup code is refused

Copy it again from writable/rolewarden/install-code.txt, without spaces. The file is created on the first visit to the installer and deleted when the installation finishes.

"Could not connect to the database"

Check server, port, database name, user and password; the database must already exist. The exact reason from the database is in writable/logs/. On many hosts the server is localhost, on Docker it is the service name.

The installer shows a text to save as .env

The web server cannot write in the application's root folder. Save the text as .env there yourself (over FTP, for example) and continue, or make the folder writable and submit the database step again.

In development every page answers 500 before the tables exist

In an existing application with CI_ENVIRONMENT = development, Shield's debug toolbar reads its own tables on every page, the installer's included. Run the migrations first (see Tables, with the installer or by hand), or open the installer in production and switch back afterwards.

Pages other than the home page answer 404

The document root must be the public/ folder, and the web server must send every request to public/index.php: CodeIgniter's public/.htaccess does it on Apache with mod_rewrite. Without rewriting, add index.php/ to the addresses, or set app.indexPage accordingly.

Panel

/rolewarden/users answers 404

The routes line is missing from app/Config/Routes.php: \RoleWarden\Config\RouteRegistrar::register($routes);.

The panel has no style

The stylesheet is served by the module at /rolewarden/assets/css/panel.css. Check that address in the browser: a 404 means the routes line is missing; anything else is in the log.

Signing in sends me to the home page

Set the login entry of $redirects in app/Config/Auth.php to 'rolewarden/users'. Shield still returns a user to the page they were trying to open, when there was one.

I can sign in but every panel page turns me away

Your account holds none of the panel's permissions. Give it a role that does, from another administrator's account or, for the first super admin, with the query in Installation.

A permission I granted is not taken into account

Changes made in the panel apply at the user's next request. A denial set on the user's own page beats every role, the super admin included. A deactivated user is denied everything. If your own code wrote the module's tables directly, call service('rolewarden')->forgetUser($id) (see API reference).

My view override is ignored

The copy must sit at app/Views/overrides/RoleWarden/Views/... with exactly the module's path after Views/, and CodeIgniter must be 4.7 or later.

Sign-in, sessions, email

The lock after failed sign-ins never triggers

Shield must record failed attempts: keep Config\Auth::$recordLoginAttempt at its default. If you moved Shield's login route, put the rw-signin filter on the new path.

More than 10 attempts a minute are refused although the setting is higher

Shield's auth-rates filter caps every IP at 10 requests a minute. Remove it from app/Config/Filters.php.

Everyone is locked out at once, or the log shows the same address for everyone

The application is behind a proxy that CodeIgniter does not trust, so every request seems to come from the proxy. List it in Config\App::$proxyIPs: see Behind a reverse proxy.

A signed-out session is still open in another tab

It ends at that browser's next request, not before.

No security email arrives

Set email.fromEmail and the SMTP settings in .env (see Installation). The log says when an email was skipped or the mail server refused it. A sign-in from a new device sends nothing on an account's very first sign-in.

Themes and languages

"The theme could not be saved"

writable/rolewarden/ must be writable by the web server. If app/Config/RoleWarden/theme.json exists, the theme is pinned by your application and cannot be changed from the panel.

Some messages stay in English in the Italian panel

Validation errors and relative dates come from CodeIgniter: install codeigniter4/translations. Names and descriptions of roles and permissions are data, written by whoever created them.

Updates and removal

After an update a screen is missing or a permission is unknown

Run php spark migrate -n RoleWarden: new screens arrive with the migration that creates their permissions.

Rolling back removed Shield too

migrate:rollback undoes whole batches. Install RoleWarden's migrations in a batch of their own and roll back with -b, as in Installation.