|

CakePHP ACL Tutorial: Initial Setup

View full index of ACL Tutorial Articles

[update] I have also written a much more detailed step-by-step tutorial on setting up the ACL and Auth Components

To begin using the ACL Component, you must first create the database tables required by the component.

Using the Cake Console, you can run the following command to generate the required tables.

cake schema run create DbAcl

This replaces the older deprecated command, ‘initdb’.

If you are unable to run the console command, you can use the DbAcl Schema File as a guide to help you manually create your own database tables.

Once the database is configured, you will need to create some ACO and ARO rows in order to start using it.

Again, the Cake Console can be used to create elements in your ACL system. The following command within the cake console will help provide some insight into how to use this feature:

cake acl help

There is a lot of flexibility with how you create and name your own ACL elements, so it is important to consider your own needs when planning this out. However, the following series of commands might represent a common set of commands to run when initializing an ACL setup.

cake acl create aro root guests
cake acl create aro guests users
cake acl create aro users admins
cake acl create aro users betty
cake acl create aco root site
cake acl create aco site Articles
cake acl create aco site Recipes
cake acl create aco site Lists
cake acl grant admins site *
cake acl grant users Articles read
cake acl grant users Recipes read
cake acl grant betty Recipes update

You should now be able to run the following commands with the displayed results:

cake acl check betty Recipes read
--> betty is allowed
cake acl check betty Recipes delete
--> betty is not allowed
cake acl check admins Lists create
--> admins is allowed

If this is all working so far, you might want to dig into your database and take a look at the database tables for a better understanding of what a functioning ACL system looks like.

More information about the ACL Component’s database tables.

[update: Aug 7, 2008. In console examples changed ROOT to root, since the upper case ROOT is no longer recognized by Cake]

Tuesday April 15, 2008

Man, you save my life! I was completly lost until I found your tutorial. Very clear and simple! Nice work!


VeRtigO    Sep 5, 12:21 PM    #

Totally agree with VeRtigO… ACL is hard to understand, but not with a great tutorial. Thanks a alot!


— Jan Sommer    Jun 26, 12:57 PM    #

Good evening. When we are unhurried and wise, we perceive that only great and worthy things have any permanent and absolute existence, that petty fears and petty pleasures are but the shadow of the reality.
I am from Laos and now study English, tell me right I wrote the following sentence: “Management training, an military staff is equal so you can also include pioneers that could be difficult customers in laying managers issues.”

Thank you very much 8). Business project management training.


Business project management training    Dec 22, 01:32 PM    #

Hi guys. Whoso would be a man must be a nonconformist.
I am from Indonesia and learning to read in English, give please true I wrote the following sentence: “Until the measure of world war ii, the noncommercial was the forex of message, forex market.”

Thank you very much :). Forex market 2009.


Forex market 2009    Jan 12, 04:13 AM    #

Name

E-mail (will not be published)

Your Website

Message

Textile Help


|

rss feed iconRSS / Atom

Aran World

My Amazon.com Wish List

I'm Aran Johnson and I make websites.

I primarily use: PHP, MySQL, SubVersion, CakePHP, TextPattern, Cream Text Editor, and Addi Turbo Needles

Contact Me

My website portfolio

Recently

Oakland Parking Violations and Fines

Tweet Design

CakePHP ACL and Auth: Record Level Protection

How To Play Hearts With Only Two Players

Facebook Privacy Settings

CakePHP Tutorials

CakePHP ACL and Auth: Record Level Protection

CakePHP ACL and Auth: Sample Website

CakePHP ACL and Auth Tutorial: Database Setup

CakePHP ACL Tutorial: Introduction

CakePHP ACL Tutorial: Usage With Auth Component

CakePHP ACL Tutorial: Initial Setup

CakePHP ACL Tutorial: Auth Component Example

CakePHP ACL Tutorial: How To Check Access

Cake PHP ACL Tutorial: The Database Tables

My Flickr

Advertisement:
Protect Your LCD or Plasma TV Screen From Accidents

All content © Aran Johnson