🍰 Roles and capabilities plugin for CakePHP
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
src
tests
webroot
.bettercodehub.yml
.codeclimate.yml
.editorconfig
.gitattributes
.gitignore
.stickler.yml
.travis.yml
LICENSE
README.md
composer.json
phpcs.xml.dist
phpstan.neon.dist
phpunit.xml.dist

README.md

Roles and Capabilities plugin for CakePHP

Build Status Latest Stable Version Total Downloads Latest Unstable Version License codecov BCH compliance

About

CakePHP 3+ plugin managing user roles and capabilities.

This plugin is developed by Qobo for Qobrix. It can be used as standalone CakePHP plugin, or as part of the project-template-cakephp installation.

Installation

You can install this plugin into your CakePHP application using composer.

This plugin works along with Qobo Groups plugin.

The recommended way to install composer packages is:

composer require qobo/cakephp-roles-capabilities

Run plugin's migration task:

bin/cake migrations migrate -p RolesCapabilities

Run required plugin(s) migration task:

bin/cake migrations migrate -p Groups

Setup

Load plugin

bin/cake plugin load --routes --bootstrap RolesCapabilities

Load required plugin(s)

bin/cake plugin load Muffin/Trash
bin/cake plugin load --routes --bootstrap CakeDC/Users

Load the Capability component in your src/Controller/AppController.php file using the initialize() method. Additionally use the CapabilityTrait in AppController. See details below:

use RolesCapabilities\CapabilityTrait;

class AppController extends Controller
{
    use CapabilityTrait;

    public function initialize()
    {
        parent::initialize();
        $this->loadComponent('Flash');
        $this->loadComponent('RolesCapabilities.Capability', [
            'currentRequest' => $this->request->params
        ]);
    }