ACL for multiple groups

2010-05-29 Thread ET5
Can any one give me some idea how I can implement ACL for Auth user
having multiple groups. Is this possible? Please give me some source
code

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


How to use ACL for Multiple Groups

2009-10-07 Thread Dave Maharaj :: WidePixels.com

 
Still cant figure this one out.

I have my var $actsAs = array('Acl' => array('requester')); in scout and
agent model, so when either is created it adds an entry to the aros table

/*ACL NODE FUNCTION*/
function parentNode() {
if (!$this->id && empty($this->data)) {
return null;
}
$data = $this->data;
if (empty($this->data)) {
$data = $this->read();
}
if (!$data['User']['role_id']) {
return null;
} else {
return array('Role' => array('id' =>
$data['User']['role_id']));
}
}
Creating a Scout or Agent also creates a user record. So everyone is a User
and User hasOne group (Scout or Agent)

What is the right way to set this up? I cant find anything anywhere about
this type of setup?

Dave
-Original Message-
From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] 
Sent: October-07-09 2:05 AM
To: 'cake-php@googlegroups.com'
Subject: ACL Question

I have 2 groups which are added by their respectful controller/model (Agent,
Scout)
 
So whena Agent or Scout is created in the AROS Table is shows up 
 
id  parent_id   model   foreign_key
alias   lft rght
92  3   Scout   4
NULL104 105
105 4   Agent   3
NULL196 197

BuildACL function and initDB

But I know there is something wrong with my initDB setup because I get:

Warning (512): AclNode::node() - Couldn't find Aro node identified by "Array
(
[Aro0.model] => User
[Aro0.foreign_key] => 3
)
" [CORE/cake/libs/model/db_acl.php, line 148]

There is no User Model...not sure why its looking for User?

How would you fix this initDB?

function initDB() {
  $role =& $this->User->Role;
  //Allow admins to everything
  $role->id = '1';
  $this->Acl->allow($role, 'controllers');
  //allow managers 
  $role->id = '2';
  $this->Acl->deny($role, 'controllers');
  $this->Acl->allow($role, 'controllers/Experiences');
  $this->Acl->allow($role, 'controllers/Notes');
  $this->Acl->allow($role, 'controllers/Portfolios');
  $this->Acl->allow($role, 'controllers/Teams');
  //allow Agents to
  $role->id = '3';
  $this->Acl->deny($role, 'controllers');
  $this->Acl->allow($role, 'controllers/Experiences');
  $this->Acl->allow($role, 'controllers/Notes');
  $this->Acl->allow($role, 'controllers/Portfolios');
  $this->Acl->allow($role, 'controllers/Teams');

  //allow Scouts to
  $role->id = '4';
  $this->Acl->deny($role, 'controllers');
  $this->Acl->allow($role, 'controllers/Teams/scout_view');


  }
 
Dave


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