Coder Social home page Coder Social logo

cakephp-acl-manager's Introduction

AclManager for CakePHP 2.x

This plugins allows you to easily manage your permissions in CakePHP 2.x through the Acl module.

Features

  • Managing permissions for each node
  • Updating Database with missing AROs (Users, Roles, ...)
  • Updating Database with missing ACOs (Controller actions)
  • Revoking all permissions

Requirements

  • CakePHP 2.x

How to install

1. Set up your Acl environment

  • Install SQL tables through Cake Console
  • parentNode() method on your requester models

See: CakePHP: Simple ACL Controlled Application

2. Configure Auth in your AppController

It should look something like this:

var $components = array('Auth', 'Acl', 'Session');

function beforeFilter() {
    //Configure AuthComponent
    $this->Auth->authorize = array(
        'Controller',
        'Actions' => array('actionPath' => 'controllers')
    );
    $this->Auth->authenticate = array(
        'Form' => array(
            'fields' => array(
                'username' => 'login',
                'password' => 'password'
            )
        )
    );
    $this->Auth->loginAction = array(
        'controller' => 'users',
        'action' => 'login',
        'admin' => false,
        'plugin' => false
    );
    $this->Auth->logoutRedirect = array(
        'controller' => 'users',
        'action' => 'login',
        'admin' => false,
        'plugin' => false
    );
    $this->Auth->loginRedirect = array(
        'controller' => 'products',
        'action' => 'index',
        'admin' => false,
        'plugin' => false
    );
}

function isAuthorized($user) {
    // return false;
    return $this->Auth->loggedIn();
}

3. Download AclManager

Manually

Download the stable branch (https://github.com/houseoftech/cakephp-acl-manager/archive/stable.zip) and paste the content in your app/Plugin/ directory.

With Composer

  1. Install composer in the app/ folder of your project.
  2. Add "houseoftech/cakephp-acl-manager": "stable" to your require key in your composer.json file. (More about this)
  3. Run php composer.phar install to install the plugin.

Composer documentation

4. Configure the plugin

See AclManager/Config/bootstrap.php

AclManager.aros : write in there your requester models aliases (the order is important)

5. Enable the plugin

In app/Config/bootstrap.php

CakePlugin::load('AclManager', array('bootstrap' => true));

6. Login with an existing user

The plugin conflicts with $this->Auth->allow(), do not use it. Just make sure that you are logged in.

7. Access the plugin at /acl_manager/acl

  • Update your AROs and ACOs
  • Set up your permissions (do not forget to enable your own public actions!)

8. Disable the authorizer Controller

Or uncomment return false in AppController::isAuthorized()

9. You're done!

Enjoy!

Licence

Licensed under the MIT License

cakephp-acl-manager's People

Contributors

flashnet69 avatar fmcorz avatar houseoftech avatar jelmerd avatar oxicode avatar wvdongen avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.