ACL Management Plugin
A simple, easy, AJAXY, solution for managing your access control lists.
Introduction
It has been done before. I believe both Mariano Iglesias (mariano_iglesias) and Andy Dawson (ad7six) have both created ACL plugins. But unfortunately, at the time of this writing, neither of them worked for me. So I decided to create an AJAX ACL plugin. I needed one for my current project, plus I wanted to contribute something else to CakePHP outside of the crappy Oracle DBO that I wrote a year ago; and writing a fancy new plugin is way more fun that writing data import scripts and reports for my boss.
Before I waste too much of your time, you're welcome to check out a demo here:
http://dev.newnewmedia.com/cakephp/admin/acl
If you're still with me, then I can explain how you can get this puppy working for yourself.
Requirements:
Instructions for Installation
Note: At the time of this writing, CakePHP has no way of bundling images/css/js within the plugin. So if you want this thing to look pretty, you're going to have to do a little extra work.
That's it! The ACL management plugin should be installed. Usage instructions are built into the plugin, so I do not have to go on at length about it here.
If you have any questions feel free to leave comments here in the Bakery.
It has been done before. I believe both Mariano Iglesias (mariano_iglesias) and Andy Dawson (ad7six) have both created ACL plugins. But unfortunately, at the time of this writing, neither of them worked for me. So I decided to create an AJAX ACL plugin. I needed one for my current project, plus I wanted to contribute something else to CakePHP outside of the crappy Oracle DBO that I wrote a year ago; and writing a fancy new plugin is way more fun that writing data import scripts and reports for my boss.
Before I waste too much of your time, you're welcome to check out a demo here:
http://dev.newnewmedia.com/cakephp/admin/acl
If you're still with me, then I can explain how you can get this puppy working for yourself.
Requirements:
- PHP 4 or 5
- CakePHP 1.2 Beta
- ACL Plugin - svn://newnewmedia.com/cakephp/plugins/acl
- Prototype 1.5.1.1 - http://www.prototypejs.org/assets/2007/6/20/prototype.js
- Tango Icon Library - http://tango-project.org/releases/tango-icon-theme-0.8.1.tar.gz
Instructions for Installation
Note: At the time of this writing, CakePHP has no way of bundling images/css/js within the plugin. So if you want this thing to look pretty, you're going to have to do a little extra work.
- Download Prototype, drop the file directly into /app/webroot/js
- Download Tango Icon Library, name the folder 'tango', and put it in /app/webroot/img
- Checkout the ACL plugin source from svn and put the 'acl' folder in /app/plugins
- edit your core.php and turn on admin routing
- Browse to the address /admin/acl
That's it! The ACL management plugin should be installed. Usage instructions are built into the plugin, so I do not have to go on at length about it here.
If you have any questions feel free to leave comments here in the Bakery.
Comments
Question
1 AclController could not be found
The first page comes ok, but I've got a "Missing controller" error by clicking on anything (Manage Aros, Manage Acos or Manage Permissions).
Error details: "You are seeing this error because controller AclController could not be found."
Could you help with this?
Thank you
Comment
2 Written for CakePHP 1.2
Comment
3 AclController could not be found
Im getting the same error using the pre-beta version of 1.2.
Comment
4 Fix the menu links
in ../acl/views/elements/acl_menu.ctp
<div class="acl_menu"><?php print $html->image('/tango/32x32/places/folder.png', array('align' => 'absmiddle')) ?><?php print $html->link('Acl Menu', array('controller'=>'acl','action'=>'admin_index')); ?>
<?php print $html->image('/tango/32x32/apps/system-users.png', array('align' => 'absmiddle')) ?><?php print $html->link('Manage Aros', array('controller'=>'acl','action'=>'admin_aros')); ?>
<?php print $html->image('/tango/32x32/apps/preferences-system-windows.png', array('align' => 'absmiddle')) ?><?php print $html->link('Manage Acos', array('controller'=>'acl','action'=>'admin_acos')); ?>
<?php print $html->image('/tango/32x32/emblems/emblem-readonly.png', array('align' => 'absmiddle')) ?><?php print $html->link('Manage Permissions', array('controller'=>'acl','action'=>'admin_permissions')); ?>
</div>
And for the index page, ../acl/views/acl/admin_index.ctp
<ul class="acl"><li><?php print $html->image('/tango/32x32/apps/system-users.png', array('align' => 'absmiddle')) ?><?php print $html->link('Manage Aros', array('controller'=>'acl','action'=>'admin_aros')); ?></li>
<li><?php print $html->image('/tango/32x32/apps/preferences-system-windows.png', array('align' => 'absmiddle')) ?><?php print $html->link('Manage Acos', array('controller'=>'acl','action'=>'admin_acos')); ?></li>
<li><?php print $html->image('/tango/32x32/emblems/emblem-readonly.png', array('align' => 'absmiddle')) ?><?php print $html->link('Manage Permissions', array('controller'=>'acl','action'=>'admin_permissions')); ?></li>
</ul>
And by the way Jeff, this is a really nice plugin and I am sure it will help me in my struggling with the auth/acl mess I've run into!
Comment
5 Database Structure
Comment
6 use the console to initialize the tables
You'll probably want to open up a shell, cd into the cake/console directory, and run this..
./cake acl initdb
Comment
7 Problems installing
i did all this:
1. Download Prototype, drop the file directly into /app/webroot/js
2. Download Tango Icon Library, name the folder 'tango', and put it in /app/webroot/img
3. Checkout the ACL plugin source from svn and put the 'acl' folder in /app/plugins
4. Browse to the address /admin/acl
http://www.dev.localhost/admin/acl
"You are seeing this error because controller AdminController could not be found.
Notice: If you want to customize this error message, create app/views/errors/missing_controller.thtml.
Fatal: Create the class below in file : app/controllers/admin_controller.php
<?php
class AdminController extends AppController {
var $name = 'Admin';
}
?>"
What should I do?
Comment
8 turn on admin routing
Comment
9 json requests not returned
I am unable to get this plugin going. The issue is that the json requests are not returned. Initially upon installing I get this error
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in D:Apache2.2.4vhosts..apppluginsaclcontrollersacl_aros_controller.php on line 36
removing the & in the foreach loop, still does not mena that requests are returned.
Warning (2): Missing argument 1 for children() [COREhtmlpluginsaclcontrollersacl_aros_controller.php, line 31]
I have made the changes above with the navigation and had a general fiddle around.
php4.4.7 cake1.2 pre beta
where am I going wrong??
Comment
10 php5
Comment
11 Downloading plugin
Now for the silly newbie question. How do I download the plugin code from svn://newnewmedia.com/cakephp/plugins/acl ?
I haven’t come across ‘svn’ before.
Comment
12 SVN
http://tortoisesvn.tigris.org/
a pleasure to use, simple also
Bug
13 Showstopper Bug with the ACL Management Plugin in newer revisions
Due to the use of a deprecated function (loadModel()) the plugins JSON model isn't loaded anymore. To solve the issue you have to replace the function
loadModel('JSON');
in each of the plugins controllers with
App::import(
$type = 'Model',
$name = 'JSON',
$parent = true,
$search = array("/your/path/to/the/plugins/JSON/dir","/Add/optional/paths/at/will"),
$file = 'JSON.php',
$return = false
);
Please help by hunting down bugs in other usefull plugins. Thanks for the ACL Manager, Jeff.
Question
14 not working for me
Missing controller
You are seeing this error because controller AclController could not be found.
Notice: If you want to customize this error message, create appviewserrorsmissing_controller.ctp
Fatal: Create the class below in file: appcontrollersacl_controller.php
<?php
class AclController extends AppController {
var $name = 'Acl';
}
?>
What am I doing wrong?
Comment
15 cake1 2 0 5875 pre beta bug for cake acl initdb
cake acl initdbgives following error:
..consoleconfig not found
Can any one help me sort out this bug ??
Thanks in advance.
Question
16 cake1 2 0 5875 pre beta bug for cake acl initdb
cake acl initdbgives following error:
...cake\console\config not foundCan any one help me sort out this bug ??
Thanks in advance.
Question
17 SVN problems
I'm having problem opening the ur svn url. FYI i'm using kdesvn.
Comment
18 can be a bug
yes i can confirm this as well. ANYONE PLS?!
Comment
19 cake acl initdb
to people facing problems. run this cmd from ROOTapp. it will issue a warning that the its deprecated and give another cmd: cake schema run create DbAcl
this will work. (ps: ur database config file should be workable)
Comment
20 fixed but works
i had to fix it adding the $name var to the controllers
var $name = 'AclAros';
var $name = 'AclAcos';
var $name = 'Acl';
var $name = 'AclPermissions';
Now it works!
Comment
21 Plugin not working correctly.
PHP 5
CakePHP 1.2.0.6811 - Beta
Plugin
Prototype 1.5.1.1
Tango Icon Library
CalePHP is in a subdirectory "Tor".
"http://localhost/Tor/admin/acl/aros" results in the manage aros page showing but a moment later it is replaced by a broken version of the page with database debug info. If I click the "stop" button at the right time, I can catch the original manage aros page. Its almost like a redirect somewhere is activated.
Comment
22 Requires Alias
Comment
23 Plugin not working correctly.
Bug
24 Not working when DB is initialized with zero records
And one more question ! Can any one simulate a scenario on DEMO site http://dev.newnewmedia.com/cakephp/admin/acl
e.g for Post vs User/Groups such that
Post
-add
-edit
-view
-delete
-admin_add
-admin_edit
-admin_view
-admin_delete
-admin-verify
Group
(root) SuperAdmin Has all rights
/create group
/create user
/create acos/aros and permissions
Mediators - cannot delete
Users - can post /and edit his own posts
An how about if we can list controllers dynamically as acos and their actions . Is not that be good if we can create alias and keys values for the acos/and aros dynamically .
Thanks in advance for your time and knowledge .
Question
25 please dont hit me
the acl_app_controller.php is in the app directory and the other controllers in the same named folder....
Comment
26 Tango link is broken
http://tango.freedesktop.org/Tango_Icon_Library
Comment
27 IE7 not loading AJAX dropdowns
The only biggish issue I am having is with compatibility with IE7. It doesnt load AJAX dropdowns for some reason. Any clues why? Its OK under Firefox.
Comment
28 IE problem
Please read:
http://forum.mootools.net/topic.php?id=4186#post-39085