Re: Different ACL permissions

2011-09-08 Thread Sam Sherlock
initDB initializes the acl aro tree in the db (mysql if thats the datasource
set in  config/database.php)
 - S




On 8 September 2011 23:43, Almacenamiento Almacenamiento <
almacenamien...@gmail.com> wrote:

> But I want to use the ACL with MYSQL not. Ini
>
> 2011/9/8 Maicon Pinto 
>
>> Eu não sei se isso pode ajudar, mas quando fiz este exemplo:
>>
>> http://book.cakephp.org/view/1550/Setting-up-permissions
>>
>> Faltava carregar o Modelo, desta forma:
>>
>> $this->loadModel('Group');
>>
>> sendo o código parcial:
>>
>> function initDB() {
>>*$this->loadModel('Group');*
>>$group =& $this->Group;
>>
>>$group->id = 1;
>>
>>(...)
>>
>> }
>>
>>  --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> 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
>>
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Different ACL permissions

2011-09-08 Thread Almacenamiento Almacenamiento
But I want to use the ACL with MYSQL not. Ini

2011/9/8 Maicon Pinto 

> Eu não sei se isso pode ajudar, mas quando fiz este exemplo:
>
> http://book.cakephp.org/view/1550/Setting-up-permissions
>
> Faltava carregar o Modelo, desta forma:
>
> $this->loadModel('Group');
>
> sendo o código parcial:
>
> function initDB() {
>*$this->loadModel('Group');*
>$group =& $this->Group;
>
>$group->id = 1;
>
>(...)
>
> }
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Different ACL permissions

2011-09-08 Thread Maicon Pinto
Eu não sei se isso pode ajudar, mas quando fiz este exemplo:

http://book.cakephp.org/view/1550/Setting-up-permissions

Faltava carregar o Modelo, desta forma:

$this->loadModel('Group');

sendo o código parcial:

function initDB() {
   *$this->loadModel('Group');*
   $group =& $this->Group;

   $group->id = 1;

   (...)

}

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Different ACL permissions

2011-09-08 Thread Almacenamiento Almacenamiento
I'm trying for weeks to integrate ACL + Auth with different permissions for
different users, and that they have privileges to access certain parts of
the site depending on the group on this. I recently found a tutorial Arabic,
and try to incorporate some files from a tutorial acl, but I'm having
difficulties Uu The idea would be to use the helper and component offering,
and use it for certain parts of the site will not display unless you have
some privilege.

This item cost me, and I read several tutorials and practice, the majority
dealt with almost the same as Users, Groups and Roles, with different
permissions, but not for access to different views depending on the group.

Aros:
Groups
   Group.1
   Group.2
   Group.3

Acos:
controllers
   Subtemas: index, view, add, edit, delete
   Posts: index, view, add, edit, delete
   Users: register, login, logout, index
  Groups: index, view, add, edit delete

In the view view to Subtemas i write ex..:
if($access->check('Subtemas/add')){ }

And I pulled:
Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions
check.  Node references:
Aro: Group:4
Aco: Subtemas/add [CORE\cake\libs\controller\components\acl.php, line 273]

Acl->check('User:'.$this->Auth->user('id'), $aco,
$action)){
return true;
} else {
return false;
}
}

function checkHelper($aro, $aco){
App::import('Component', 'Acl');
$acl = new AclComponent();
return $acl->check($aro, $aco, '*');
}
}
?>

Access = new AccessComponent();

App::import('Component', 'Auth');
$this->Auth = new AuthComponent();
$this->Auth->Session = $this->Session;
$this->user = $this->Auth->user();
}

function check($aco, $action='*'){
if(empty($this->user)) return false;
return $this->Access->checkHelper('User:'.$this->user['User']['id'],
$aco);
}

function isLoggedin(){
return !empty($this->user);
}

function my($column = null){
App::import('Component', 'Auth');
$auth = new AuthComponent();
$auth->Session = $this->Session;
if($auth->user($column)){
return $auth->user($column);
}else{
return FALSE;
}
}

function isSelected($controller = null, $action = 'index'){
$curr_controller = $this->params['controller'];
$curr_action = $this->params['action'];
if($curr_controller == $controller && $curr_action == $action){
return 'selected';
} else {
return null;
}
}
}
?>

I hope I can help. Thank you very much ...!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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