2017 © Pedro Peláez
 

cakephp-plugin role-auth

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be.

image

potatopowered/role-auth

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be.

  • Tuesday, July 3, 2018
  • by potatopowered
  • Repository
  • 3 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 80 % Grown

The README.md

RoleAuth

Software License Travis Codecov Packagist, (*1)

Description

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be., (*2)

Installation Guide

Add the component to your composer.json you can do this easily using composer itself., (*3)

composer require potatopowered/role-auth

Add the roles table using migrate., (*4)

bin/cake migrations status -p RoleAuth

Load the RoleAuth Component with the other components in the initialize function of your AppController to have it accessible in all controllers., (*5)

$this->loadComponent('RoleAuth.RoleAuth');

Advanced Load

$this->loadComponent('RoleAuth.RoleAuth', [
  'roles_table' => 'roles',
  'admin_role' => 'Admin',
  'default_role' => 'User'
]);

Usage

This assumes that you have role_id setup in the user linking to this plugins roles table., (*6)

Check if a user is an admin

To use the RoleAuth component to check if a user is an admin you can make a call as such. The following will check the logged in users role_id and verify that they are an admin or not. The result is boolean., (*7)

$this->RoleAuth->isAdmin($this->Auth->user('role_id'));

Check if a user has a specific role

To use the RoleAuth component to check if a user is a specific role you can make a call as such. The following will check the logged in users role_id and verify that they have a role or not. The result is boolean., (*8)

$this->RoleAuth->hasRole('YourRole', $this->Auth->user('role_id'));

Set all role variables

To use the RoleAuth component to check the users role and set all role variables in one shot you can make a call as such. The following will check the logged in users role_id and verify that they have a role or not. The result is boolean., (*9)

$this->RoleAuth->setRoles($this->Auth->user());

The Versions

03/07 2018

dev-master

9999999-dev

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Blake Sutton

authorization cakephp potato powered software roleauth

03/07 2018

1.1.2

1.1.2.0

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Blake Sutton

authorization cakephp potato powered software roleauth

03/07 2018

1.1.1

1.1.1.0

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Blake Sutton

authorization cakephp potato powered software roleauth

22/05 2018

1.1.0

1.1.0.0

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Blake Sutton

authorization cakephp potato powered software roleauth

17/05 2018

dev-development

dev-development

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Blake Sutton

authorization cakephp potato powered software roleauth

30/07 2017

1.0.1

1.0.1.0

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Blake Sutton

authorization cakephp potato powered software roleauth

30/07 2017

1.0.0

1.0.0.0

The RoleAuth Component aims to make authorization in CakePHP 3.x applications as simple as can be.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Blake Sutton

authorization cakephp potato powered software roleauth