preflow / roles
Preflow roles — simple roles from config/roles.php answering can()
Requires
- php: >=8.4
- preflow/auth: ^0.65 || @dev
- preflow/core: ^0.20 || @dev
Requires (Dev)
- nyholm/psr7: ^1.8
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
- preflow/auth: <0.65
Replaces
None
- dev-main
- v0.76.0
- v0.75.0
- v0.74.0
- v0.73.0
- v0.72.1
- v0.72.0
- v0.71.1
- v0.71.0
- v0.70.0
- v0.69.2
- v0.69.1
- v0.69.0
- v0.68.1
- v0.68.0
- v0.67.0
- v0.66.2
- v0.66.1
- v0.66.0
- v0.65.0
- v0.64.0
- v0.63.2
- v0.63.1
- v0.63.0
- v0.62.0
- v0.61.0
- v0.60.1
- v0.60.0
- v0.59.0
- v0.58.1
- v0.58.0
- v0.57.0
- v0.56.1
- v0.56.0
- v0.55.0
- v0.54.1
- v0.54.0
- v0.53.2
- v0.53.1
- v0.53.0
- v0.52.0
- v0.51.0
- v0.50.0
- v0.49.1
- v0.49.0
- v0.48.5
- v0.48.4
- v0.48.3
- v0.48.2
- v0.48.1
- v0.48.0
- v0.47.1
- v0.47.0
- v0.46.1
- v0.46.0
- v0.45.0
- v0.44.0
- v0.43.0
- v0.42.1
- v0.42.0
- v0.41.2
- v0.41.1
- v0.41.0
- v0.40.0
- v0.39.0
- v0.38.0
- v0.37.0
- v0.36.0
- v0.35.0
- v0.34.1
- v0.34.0
- v0.33.0
- v0.32.0
- v0.31.0
- v0.30.0
- v0.29.0
- v0.28.0
- v0.27.1
- v0.27.0
- v0.26.0
- v0.25.1
- v0.25.0
- v0.24.1
- v0.24.0
- v0.23.0
- v0.22.1
- v0.22.0
- v0.21.0
- v0.20.0
- v0.19.2
- v0.19.1
- v0.19.0
- v0.18.1
- v0.18.0
This package is auto-updated.
Last update: 2026-11-14 19:29:54 UTC
README
Simple roles for Preflow. It answers the one permission question,
can('page.publish'), from a config file: each role is a list of permission
patterns.
composer require preflow/roles
// config/providers.php return [\Preflow\Roles\RolesServiceProvider::class /* , ... */];
// config/roles.php return [ 'staff' => [ 'admin' => ['*'], 'editor' => ['page.*', 'news.*', 'assets.*'], ], 'members' => [ 'premium' => ['downloads.premium'], ], ];
A user's roles come from getRoles() (for the config user provider, the
roles key of each user). Roles are looked up in the user's population only:
staff for guards marked as staff (Folio's, or population: 'staff' in
config/auth.php), members for everyone else.
Patterns
page.editmatches exactly that permission.page.*matches everything belowpage.(page.edit,page.blocks.edit), but notpages.editand notpageitself.*matches every permission.
Edge cases
- A role in a user that
config/roles.phpdoesn't define grants nothing. In debug it is logged once per request; it never throws. - A user without roles gets nothing.
- Without
config/roles.phpthe package changes nothing: staff may do everything, members nothing (thepreflow/authdefault).
For roles edited in the admin, per-record rules and user management, use a full
RBAC package instead; code asks can() the same way either way.