Download the PHP package preflow/rbac without Composer

On this page you can find all versions of the php package preflow/rbac. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package rbac

preflow/rbac

Roles managed in Folio, answering can().

Install

Roles

Roles are rbac_role records, edited under Settings → Roles: a name (unique per population), a label, a population (staff or members) and permissions.

User types

A user type gives its users roles with an rbac_roles field:

The field lists the roles of the type's users population; a "population" on the field names another one. The value is a list of role names.

Delegation

Nobody grants permissions they don't hold. Coverage follows how permissions match:

When a user is signed in:

The messages are in English, like the rest of Folio's admin. A site's lang/en/rbac.php changes single keys; de and fr are in lang/. Without a signed-in user (the CLI: folio:extensions:apply, the staff import) delegation does not apply. Preflow\Rbac\PermissionCoverage has the check: covers(), coversAll(), uncovered(), and held() for the signed-in user (null when nobody is signed in).

Staff accounts

Staff accounts are records, managed in Folio by staff who may. The part model:staff is opt-in: enabling rbac doesn't add it. A site lists it under the extension's enabled_parts in config/folio/extensions.json and runs folio:extensions:apply:

Two roles: super admin and content admin

There is no negation, so a narrower role lists what it gets. New types, including the settings of an extension enabled later, stay hidden from it until granted.

A content admin can't edit a super admin's account or role, and can't grant what they don't hold. tests/TwoRolesTest.php checks both roles on every admin route and screen.

No lock-out

Every save and delete of an account or a role, the CLI included, must leave at least one active manager ("At least one account must keep the right to manage staff and roles."). A manager is an active staff account whose roles grant staff.edit and rbac_role.edit.

Account lifecycle

Types/StaffAdmin adds an Account panel to the staff form, with record actions. They need the permission staff.edit. Each one is checked by StaffRules on the record as it would be saved. A crafted POST to an account above you, or disabling the last manager, gets the same refusal as the form, shown as a flash.

Mails need config/notify.php; the throttles need APP_KEY. The action messages are rbac.staff.* in lang/{en,de,fr}/rbac.php.

Moving a config admin to staff

php preflow folio:staff:import-config creates a staff record for each config user of the default guard's provider (directly, or inside a chain).

For an existing site with an .env admin:

  1. In config/auth.php, point the guard at a chain: staff records first, then the config users:

    While the staff type isn't enabled yet, the chain resolves the config user as before.

  2. Enable model:staff (enabled_parts) and run php preflow folio:extensions:apply.
  3. Run php preflow folio:staff:import-config.
  4. Sign in again with the old password. Once the record exists, it decides for that e-mail: the config entry no longer answers it, and the config-era sessions and remember-me cookies end on their next request (from now on, disabling or demoting the record takes effect).
  5. Later, remove the config user (and the chain, pointing the guard at staff) and the FOLIO_ADMIN_* values in .env.

Revisions store the author's id from then on. Folio shows the account's name for an id and the stored e-mail for older revisions.

Limits

Keeping the right to edit roles

A save or delete of a role is refused when, on the roles as they would be afterwards:

This covers removing permissions, renaming the role, moving it to members and deleting it. A refused save shows the form again with the message; a refused delete keeps the role. Before the extension is installed, the same check applies: the first role you save must grant yourself rbac_role.view and rbac_role.edit (or run folio:extensions:apply, which creates admin).

Bootstrap

Until folio:extensions:apply has installed the extension in this environment, staff may do everything (logged once per request), so enabling RBAC never locks out the admin. Once installed, staff get only what their roles grant; with no staff role at all they get nothing (logged: "no staff roles defined; run folio:extensions:apply or create one under Settings → Roles").

Switching from preflow/roles

preflow/rbac replaces preflow/roles while the extension is enabled (its resolver wins).

  1. Require preflow/rbac, add its provider, enable the extension.
  2. Run php preflow folio:extensions:apply: the roles of config/roles.php become rbac_role records (and admin, if you had no staff role).
  3. Check the roles under Settings → Roles, then remove preflow/roles and config/roles.php when you like; later edits happen in Folio only.

All versions of rbac with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
preflow/auth Version ^0.69 || @dev
preflow/core Version ^0.62 || @dev
preflow/data Version ^0.78 || @dev
preflow/i18n Version ^0.37 || @dev
preflow/notify Version ^0.69 || @dev
psr/log Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package preflow/rbac contains the following files

Loading the files please wait ...