2017 © Pedro Peláez
 

cakephp-plugin my-acl

CakePHP plugin for manage ACL with a friendly interface.

image

nrayann/my-acl

CakePHP plugin for manage ACL with a friendly interface.

  • Thursday, September 15, 2016
  • by nrayann
  • Repository
  • 2 Watchers
  • 1 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

MyAcl plugin for CakePHP

Latest Stable Version Total Downloads License composer.lock, (*1)

Installation

You can install this plugin into your CakePHP application using composer., (*2)

The recommended way to install composer packages is:, (*3)

composer require 'nrayann/my-acl:dev-master'

Include the ACL and MyAcl plugin in app/config/bootstrap.php, (*4)

Plugin::load('Acl', ['bootstrap' => true]);
Plugin::load('MyAcl', ['bootstrap' => false, 'routes' => true]);

Include and configure the AuthComponent and the AclComponent in the AppController, (*5)

public $components = [
    'Acl' => [
        'className' => 'Acl.Acl'
    ]
];
...
$this->loadComponent('Auth', [
    'authorize' => [
        'Acl.Actions' => ['actionPath' => 'controllers/']
    ],
    'loginAction' => [
        'plugin' => false,
        'controller' => 'Users',
        'action' => 'login'
    ],
    'loginRedirect' => [
        'plugin' => false,
        'controller' => 'Pages',
        'action' => 'display'
    ],
    'logoutRedirect' => [
        'plugin' => false,
        'controller' => 'Users',
        'action' => 'login'
    ],
    'unauthorizedRedirect' => [
        'plugin' => false,
        'controller' => 'Users',
        'action' => 'login',
        'prefix' => false
    ],
    'authError' => 'You are not authorized to access that location.',
    'flash' => [
        'element' => 'error'
    ]
]);

Add UsersController::login function, (*6)

public function login() {
    if ($this->request->is('post')) {
        $user = $this->Auth->identify();
        if ($user) {
            $this->Auth->setUser($user);
            return $this->redirect($this->Auth->redirectUrl());
        }
        $this->Flash->error(__('Your username or password was incorrect.'));
    }
}

Add UsersController::logout function, (*7)

public function logout() {
    $this->Flash->success(__('Good-Bye'));
    $this->redirect($this->Auth->logout());
}

Add src/Templates/Users/login.ctp, (*8)

<?= $this->Form->create() ?>
<fieldset>
    <legend><?= __('Login') ?></legend>
    <?= $this->Form->input('username') ?>
    <?= $this->Form->input('password') ?>
    <?= $this->Form->submit(__('Login')) ?>
</fieldset>
<?= $this->Form->end() ?>

Set up your database config in config/app.php, (*9)

Run bin/cake migrations migrate -p Acl to create acl tables., (*10)

Run bin/cake acl_extras aco_sync to automatically create ACOs., (*11)

Run bin/cake migrations migrate -p MyAcl to create Users and Groups tables., (*12)

Run bin/cake migrations seed --seed UsersSeed -p MyAcl to create the admin user., (*13)

Run bin/cake acl grant Groups.1 controllers to grant permissions for admin group., (*14)

Inside the project folder, run sudo chmod -R 777 tmp/ to solve/avoid permission errors., (*15)

Log in credentials: username: you@example.com password: 123456, (*16)

For aco sync, access http://"your-application-address"/my-acl/permissions/acoSync, (*17)

For grant/deny permissions to users and groups, click on permissions buttom at actions column in its index template., (*18)

For hide or show ACOS on permission lists, click on config buttom or access http://"your-application-address"/my-acl/permissions/config, (*19)

The Versions

15/09 2016

dev-master

9999999-dev https://github.com/nrayann

CakePHP plugin for manage ACL with a friendly interface.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin acl cakephp cakephp3

15/09 2016

1.0.0-alpha

1.0.0.0-alpha https://github.com/nrayann

CakePHP plugin for manage ACL with a friendly interface.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin acl cakephp cakephp3

13/09 2016

dev-development

dev-development https://github.com/nrayann

CakePHP plugin for manage ACL with a friendly interface.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin acl cakephp cakephp3