Hi,

About 'Undefined index: content' error, you should already know how to fix
it.

About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check'
error, are the ACL tables (aros, acos and aros_acos) populated correctly?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 2:56 PM, John Maxim <goog...@gmail.com> wrote:

> Hi Amit, Thanks...!
>
> I just put it in the controllers components--access.php:
> ----------
> <?
> class AccessComponent extends Object{
>        var $components = array('Acl', 'Auth');
>        var $user;
>
>        function startup(){
>                 $this->user = $this->Auth->user();
>        }
>
>        function check($aco, $action='*'){
>                 if(!empty($this->user) && $this->Acl->check('User::'.$this-
> >user['User']['id'], $aco, $action)){
>                        return true;
>                } else {
>                        return false;
>                }
>        }
>
>        function checkHelper($aro, $aco, $action = "*"){
>                App::import('Component', 'Acl');
>                $acl = new AclComponent();
>                return $acl->check($aro, $aco, $action);
>        }
> }
> ?>
> --------------
>
> Now the errors are:
> ~~
>
> Notice (8): Undefined index: content [APP\views\posts\index.ctp, line
> 7]
> ~~
> Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in
> permissions check.  Node references:
> Aro: User::44
> Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273]
> ~~
>
> Regards,
> Maxim
>
> On Dec 29, 4:43 pm, Amit Badkas <amit.sanis...@gmail.com> wrote:
> > Hi,
> >
> > Have you had AccessComponent class defined in
> > app/controllers/components/access.php?
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Wed, Dec 29, 2010 at 1:30 PM, John Maxim <goog...@gmail.com> wrote:
> > > <?php
> > > class AccessHelper extends Helper{
> > >        var $helpers = array("Session");
> > >        var $Access;
> > >        var $Auth;
> > >        var $user;
> >
> > >        function beforeRender(){
> > >                App::import('Component', 'Access');
> > >                $this->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, $action);
> > >        }
> >
> > >        function isLoggedin(){
> > >                return !empty($this->user);
> > >        }
> > > }
> > > ?>
> >
> > > ------------
> >
> > > This access.php file is saved in app/views/helpers
> > > ------------
> > > In "Posts" Controller, I have added: var $helpers = array('Access');
> >
> > > So it can be accessed from the view.
> >
> > > My Posts index is here:
> > > ------------------------------
> > >  <h2>Welcome to my CakePHP Blog</h2>
> >
> > > <? foreach($posts as $post): ?>
> >
> > >        <h3><a href="/posts/view/<? echo $post['Post']['id'] ?>"><? echo
> > > $post['Post']['title'] ?></a></h3>
> >
> > > <p><? echo $post['Post']['content'] ?></p>
> >
> > > <? if($access->isLoggedin() && $access->check('Post')): ?>
> >
> > > <small><a href="/posts/edit/<? echo $post['Post']['id'] ?>">edit</a>
> > > |
> > > <? echo $html->link('delete', '/posts/delete/'.$post['Post']['id'],
> > > NULL, 'Are you sure?'); ?></small>
> >
> > > <? endif; ?>
> > > <hr />
> > > <? endforeach; ?>
> > > -----------------------------------
> >
> > > I got this error as I view Posts index:
> > > -------------------
> > > Fatal error: Class 'AccessComponent' not found in C:\wamp\www\cakephp
> > > \app\views\helpers\access.php on line 10
> > > -------------------
> >
> > > Line 10 points to this:
> > > ------------------------
> > > $this->Access = new AccessComponent();
> > > -------------------------
> >
> > > ~~
> >
> > > What am I trying to accomplish ?
> >
> > > The edit and delete links can only be viewed when User is logged in.
> > > If not logged in, only the Posts index and view page are viewable--
> > > without displaying the edit and delete links to the Guest users.
> >
> > > ~~
> >
> > > Is the method of doing wrong ? what is the suggested way ?
> >
> > > Thanks,
> > > Maxim
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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<cake-php%2bunsubscr...@googlegroups.com>
> <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>>For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> 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<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

Reply via email to