ACL problem

2007-04-03 Thread rockanj

I've done the following:


$aro= new Aro();
$aco= new Aco();

//aro groups
$aro->create(0,null,'Super');
$aro->create(0,null,'Administrator');
$aro->create(0,null,'AddOnly');
$aro->create(0,null,'ReadOnly');
$aro->setparent('Super','root');

//aco groups
$aco->create(0,null,'user management');
$aco->create(0,null,'protected area management');
$aco->create(0,null,'protected area data entry');
$aco->create(0,null,'protected area list');
//an aro
$aro->create(1, null, 'root');
//acos
$aco->create(1,null,'/users/edit');
$aco->create(2,null,'/users/add');
$aco->create(3,null,'/users/delete');
$aco->create(4,null,'/users/view');
$aco->create(5,null,'/users/index');
$aco->create(6,null,'/users/managegroups');
$aco->create(7,null,'/users/manageusers');

$aco->create(8,null,'/protectedareas/edit');
$aco->create(9,null,'/protectedareas/add');
$aco->create(10,null,'/protectedareas/view');
$aco->create(11,null,'/protectedareas/index');


$aco->setparent('protected area  management', '/protectedareas/
edit');
$aco->setparent('protected area data entry', 
'/protectedareas/add');
$aco->setparent('protected area  management', '/protectedareas/
view');
$aco->setparent('protected area list', '/protectedareas/index');

$aco->setparent('user management','/users/add');
$aco->setparent('user management', 'users/edit');
$aco->setparent('user management', 'users/delete');
$aco->setparent('user management', 'users/view');
$aco->setparent('user management', 'users/index');
$aco->setparent('user management', 'users/managegroups');
$aco->setparent('user management', 'users/manageusers');

Access Control/
$this->Acl->allow('Super','user management');
$this->Acl->allow('Super','protected area management');
$this->Acl->allow('Super','protected area data entry');
$this->Acl->allow('Super','protected area list');

$this->Acl->allow('Administrator','protected area management');
$this->Acl->allow('Administrator','protected area data entry');
$this->Acl->allow('Administrator','protected area list');

$this->Acl->allow('AddOnly','protected area data entry');
$this->Acl->allow('AddOnly','protected area list');

$this->Acl->allow('ReadOnly','protected area list');

The problem is that, root is allowed to visit the /users/add page but
not /users/edit page even if they belong to the same aco group. Why is
this? Please find the problem and tell me what it is...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



ACL page restriction

2007-03-17 Thread rockanj

I want to use ACL such that the actions of a controller are limited to
some users.

I have 3 AROs group
Administrator
Addonly
Readonly
I want to create ACO so that Readonly users can visit only /index page
of any controller, Addonly users cannot visit /edit and /delete, and
Administrator can visit all of them

That is
Administrator -> can access all pages
Addonly   -> can access only /*/add and /*/index but not /*/edit/
* and /*/delete/*
Readonly  -> can access only /*/index

I have seen the cake's manual but it doesn't give the real example.
So, please send me the sample code how I can do it...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



placing methods in appcontroller so as to reduce the code redundancy

2007-03-04 Thread rockanj


I have many controllers those have similar code. The difference in the
codes among them is the name, fieldnames in the DB etc. What I've been
doing right now is, I have created one controller. Then i create the
next controller, copy and paste the code from the first controller and
find and replace the name of the controller, modelname, fieldname etc.
I have done the same thing to other controllers as well. The methods
like add, edit, index etc are common to all controller.

What I want to do is to reduce the code. i.e I want a code to be
placed somewhere and that will be used by all the controllers. How can
I do that? Will it be helpful by placing the code in appcontroller ?
If so, tell me how can I do it...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---