Giter Site home page Giter Site logo

cauth's Introduction

Cauth

A simple Cakephp ACL based authentication plugin

Prerequisite

  1. Plugin AclExtras
  2. jQuery library enabled in layout

Installation

  1. Clone the repo or download a tarball and install it into app/Plugin/Cauth or in any of your plugin Paths.

  2. Import “Cauth.sql” in your database.

  3. Enable plugin at “boostrap.php”.

  4. Add the following code in AppController.php

    public $helpers = array ('Form', 'Time', 'Html', 'Session', 'Js'); public $counter = 0; public $components = array ( 'RequestHandler', 'Acl', 'Auth' => array ( 'authError' => 'Did you really think you are allowed to see that?', 'authorize' => array ( 'Actions' => array ( 'actionPath' => 'controllers', 'userModel' => 'Cauth.User', ), ) ), 'Session' );

    public function beforeFilter() {

     //Configure AuthComponent
     $this->Auth->loginAction    = array ('plugin'     => 'cauth', 'controller' => 'users', 'action'     => 'login');
     $this->Auth->logoutRedirect = array ('plugin'     => 'cauth', 'controller' => 'users', 'action'     => 'login');
     $this->Auth->loginRedirect  = array ('plugin'     => '', 'controller' => 'pages', 'action'     => 'display');
    

    }

  5. We need to create group and user. As without any user we can not create, so for 1st time create we will allow add action in both user and group controller. public function beforeFilter() { parent::beforeFilter(); $this->Auth->allow('add'); }

  6. Add an new group, say "Administrator".

  7. Add a new user under "Administrator" group.

  8. Now remove or block the codes in both controller.

  9. Allow 'initDB', 'acoSync' and 'index' action from utils controller. public function beforeFilter() { parent::beforeFilter(); $this->Auth->allow('initDB', 'acoSync', 'index'); }

  10. Run http://yourdomain/cauth/utils/acoSync

  11. Run http://yourdomain/cauth/utils/initDB

  12. Run http://yourdomain/cauth/utils/updateItem

  13. Again remove or block these code from utils controller.

  14. Now Cauth is ready to use.

Usage

  1. A complete ACL based group permission option
  2. Rename option for controllers and action for user readability.
  3. Hiding the actions from user that is not necessary for them but has used to perform some internal actions.

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.