boleiros/guardian

ACL plugin for CakePHP 3.x

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 0

Open Issues: 0

Type:cakephp-plugin

dev-master 2017-05-20 14:03 UTC

This package is auto-updated.

Last update: 2024-03-29 03:50:39 UTC


README

Installation

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

The recommended way to install composer packages is:

composer require boleiros/guardian

Enable Plugin

// config/bootstrap.php

Plugin::load('Guardian', ['bootstrap' => true, 'routes' => true]);

Or, in your terminal:

bin/cake plugin load -b -r Gardian

Run Migrations

bin/cake migrations migrate --plugin Guardian

Usage

  1. import and use the Guardian Trait on your user Model
//User.php
<?php
namespace App\Model\Entity;

use Cake\ORM\Entity;
use Guardian\Model\Traits\Guardian;

class User extends Entity
{

    use Guardian;
    ....

  1. call the method passing the name of the permission: $user->hasPermission('users.index')