Hi,

For a project I'm implementing its CakePHP ACL-component. I'm making
use of the "CRUD"-authorization. I want to be able to specify rights
on a record specific level, but I have a feeling the core component
doesn't support this.

Therefore I've altered the file /cake/libs/controller/components/
auth.php (line 489) in a way that it does support it:

Before:
$valid = $this->Acl->check(
        $user,
        $this->action(':controller'),
        $this->actionMap[$this->params['action']]
);

After:
if(count($this->params['pass'])==1){
        $fk = $this->params['pass'][0];
        $model = Inflector::singularize($this->params['controller']);
        $valid = $this->Acl->check(
                $user,
                array('model' => $model, 'foreign_key' => $fk),
                $this->actionMap[$this->params['action']]
        );
}else{
        $valid = $this->Acl->check(
                $user,
                $this->action(':controller'),
                $this->actionMap[$this->params['action']]
        );
}

Technically it works excellent. I'm just wondering if this is a decent
way of solving the problem..In my opinion the original does not
support ACL authorization using the "model" and "foreign key"columns.
With my solution it will. Am I correct?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to