> HiJohn thx for your response
>
> acting that way will bloat my app
> i have hundreds of possible combinations :\
why not just do something simple based on configuration
so e.g.
// app controller beforeFilter
Configure::write('authtype', 'peon');
in before validate in your models
$authtype = Configure::read('authtype');
if ($authtype === 'peon') {
$this->validate = $this->validateForPeons;
} elseif ($authtype === 'admin') {
$this->validate = $this->validateForAdmins;
}
use a helper to wrap your form/link requirements
echo $aHtml->link('admin home', '/admin');
echo $aForm->create();
echo $aForm->inputs();
echo $aForm->end();
// in your a html helper - example to give you an idea, not to copy
paste and use
function link(...) {
if (Configure::read('authtype') !== 'admin')) { <- read from your
auth rules in some manner
return;
}
return parent::link(...);
}
// in your a form helper - example to give you an idea, not to copy
paste and use
function input(...) {
if (Configure::read('authtype') === 'peon' && $field === 'status'))
{ <- read from your auth rules in some manner
return;
}
return parent::input(...);
}
Unless your rules change at run time and are user specific - I
wouldn't use acl to solve it, unless you use iniacl.
hth
AD
--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment