GithubHelp home page GithubHelp logo

sharkooon / niceauth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rsmartin/niceauth

0.0 1.0 0.0 283 KB

Acl/Auth Management Plugin for CakePHP 2.0

Home Page: http://niceauth.rsmartin.me

niceauth's Introduction

NiceAuth for CakePHP 2.0


NiceAuth is a plugin for CakePHP the allows for easy management of users and permissions using CakePHP's ACL and Auth Components. This plugin is currently very alpha and I would not recommend it for production environments out of the box.

Shell Access is required to setup NiceAuth

Demo available at http://niceauth.rsmartin.me

Please post your ideas, comments and issues on our github page so we can continue development.

Installation

Please read and follow each step to insure a successful installation. I highly recommend you use a fresh installation of cakephp to test out this plugin. Make sure your CakePHP installation is installed, viewable to the web and connected to your database. The home page of your installation will guide you in setting up CakePHP

To use the password reset feature, you must setup your email config file. Navigate to app/Config and copy email.php.default to email.php. Change setting to meet your setup.

From terminal, navigate to your app/Plugin folder and clone the Git repo.

git clone http://github.com/rsmartin/NiceAuth.git

Next, we need to the following line to the end of our app/Config/bootstrap.php file to load our plugins

CakePlugin::load('NiceAuth', array('routes' => true));

Now, create your AppController.php file in app/Controllers and insert the following:

<?php

class AppController extends Controller {
	
	var $uses = array('User', 'Group', 'Acl');
	public $components = array(
		'Acl',
		'Session',
		'Auth' => array(
			'loginAction' => array(
				'controller' => 'users',
				'action' => 'login'
				),
			'authError' => 'You are not authorized to view that page',
			)
		);
		
	public function beforeFilter() {
		$this->Auth->authorize = array(
    	AuthComponent::ALL => array('actionPath' => 'controllers'),
    		'Actions'
			);
		}
  
	}

?>

Next, from terminal, navigate to your app folder (eg. cakephp/app). Enter:

Console/cake nice_auth.nice_auth db_init

You will be asked four questions for setting up the database. Enter y and enter for each. This will create the Acl, User and Group databases as well as setup your Aco's and a superadmin user.

Take note of the admin username and password once the process completes

You can now navigate to yoursite.com/dashboard and login with the login credentials given to you earlier

Lastly you must set your home page to allow it to be viewed. The quickest method is to copy the PagesController.php from cakephp/lib/Controller to cakephp/app/Controllers then add the following within the class

public function beforeFilter() {
	$this->Auth->allow('*');
	}

NOTE

Every time you create a new controller or action, it must be added to the Acl Database. You can do this by navigating to cakephp/app in terminal and entering:

Console/cake nice_auth.nice_auth update

All of the above steps must be completed before you can access your site

For help with other tasks, go to /dashboard and click the help tab

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.