In my app/app_controller.php file i have this function:

function authorized()
        {
                //If the permissions array doesn't exist, everything is accessed
based. [Whitelist]
                if(isset($this->actionPermissions))
                {
                        //Same case if it does, but the sub-arrays aren't
                        
if(isset($this->actionPermissions['public'])&&in_array($this-
>action,$this->actionPermissions['public']))
                        {
                                //Marked as public - ok hf :)
                                return true;
                        }
                        else if(isset($this-
>actionPermissions['restricted'])&&in_array($this->action,$this-
>actionPermissions['restricted']))
                        {
                                //Marked as restricted - only if u r a 
registered user u will be
able to access this action
                                if($this->Session->check('User'))
                                {
                                        return true;
                                }
                        }
                }
                return false;
        }

the function checks if the client has permission to access the action
he requests (there is an array actionPermissions which holds the list
of public / restricted actions).

In my beforeFilter() function on the same page i have:

if(!$this->authorized())
                {
                        $this->viewPath = 'errors';
                        $this->render('unauthorized_error');
                        exit();
                }
(from the following tutorial: labs.iamkoa.net/2007/11/20/custom-
cakephp-errors-a-complete-run-down/ )

everything works fine, BUT in cases where i should normally get
"misssing controller, missing model, missing table, etc" errors, i
still get my "unauthorized_error" :( . I want that somehow it will
display my error only if everything is fine (no other error occurred).
How is this feasible?

-thx in advance :)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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