Hi John,

you want to setup cake so you can use it from commandline

bake is one part of cakes commandline

also acl too: (output from commandline)

$ cake acl
Available ACL commands:
         - create
         - delete
         - setParent
         - getPath
         - check
         - grant
         - deny
         - inherit
         - view
         - initdb
         - help

so `cake acl initdb` would setup the db structure which you previously
posted

you don't have to, setup cake to run from commandline, but it is an
advantage if you do

also checkout the ACL tutorial by Mark Story (end to end acl parts 1 & 2);
it covers
populating the tables and setting up controllers models etc - its the least
confusing acl tutorial out there :)

additionally acl_extras a shell plugin is truly useful (also by Mark Story)

hth  - S





On 29 December 2010 10:42, John Maxim <goog...@gmail.com> wrote:

> Is Bake continued from scaffolding ? can I jump straight to learn
> Bake ?
>
> Must we use Bake to populate the Acl tables ?
>
>
> Regards,
> Maxim
>
> On Dec 29, 6:12 pm, Amit Badkas <amit.sanis...@gmail.com> wrote:
> > Hi,
> >
> > My question was 'are the ACL tables (aros, acos and aros_acos) populated
> > correctly?', please refer tohttp://
> book.cakephp.org/view/1543/Simple-Acl-controlled-Applicationto
> > understand how to populate ACL tables.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Wed, Dec 29, 2010 at 3:35 PM, John Maxim <goog...@gmail.com> wrote:
> > > Thanks Amit,
> >
> > > Yes, the first undefined: is solved, I posted a post before yours. I
> > > ran the DB sql scripts with no error. The sql is as follow:
> >
> > > ~~~~
> >
> > > CREATE TABLE acos (
> > >  id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
> > >  parent_id INTEGER(10) DEFAULT NULL,
> > >  model VARCHAR(255) DEFAULT '',
> > >  foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
> > >  alias VARCHAR(255) DEFAULT '',
> > >  lft INTEGER(10) DEFAULT NULL,
> > >  rght INTEGER(10) DEFAULT NULL,
> > >  PRIMARY KEY  (id)
> > > );
> >
> > > CREATE TABLE aros_acos (
> > >  id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
> > >  aro_id INTEGER(10) UNSIGNED NOT NULL,
> > >  aco_id INTEGER(10) UNSIGNED NOT NULL,
> > >  _create CHAR(2) NOT NULL DEFAULT 0,
> > >  _read CHAR(2) NOT NULL DEFAULT 0,
> > >  _update CHAR(2) NOT NULL DEFAULT 0,
> > >  _delete CHAR(2) NOT NULL DEFAULT 0,
> > >  PRIMARY KEY(id)
> > > );
> >
> > > CREATE TABLE aros (
> > >  id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
> > >  parent_id INTEGER(10) DEFAULT NULL,
> > >  model VARCHAR(255) DEFAULT '',
> > >  foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
> > >  alias VARCHAR(255) DEFAULT '',
> > >  lft INTEGER(10) DEFAULT NULL,
> > >  rght INTEGER(10) DEFAULT NULL,
> > >  PRIMARY KEY  (id)
> > > );
> >
> > > ~~~
> >
> > > On Dec 29, 5:56 pm, Amit Badkas <amit.sanis...@gmail.com> wrote:
> > > > 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.organdhelp
> > > > > 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>
> >
> > > <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> >
> >
> > > > > <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> >
> > > <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> <cake-php%25252bunsubscr...@googlegroups.com<cake-php%2525252bunsubscr...@googlegroups.com>
> >
> > > >>For
> > > > > more options, visit this group at
> > > > > > >http://groups.google.com/group/cake-php?hl=en
> >
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > 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>
> >
> > > <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> >>For
> > > more options, visit this group at
> > > > >http://groups.google.com/group/cake-php?hl=en
> >
> > > 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