Hey,

I got a simple but important question which is buggin me for days
now...

Simple example:

echo $form->input('Model.field', array(
    'label' => __('Label', true)
));

This is the usual way, it's simple, it's nice and it works.

What I need is a chance to manipulate this array of options by
runtime. I need to check the Permissions of the logged in user and
then decide whether the field should be shown or NOT!

I resolved the following solution for this problem, but I think it's
not really good yet, there has to be a more elegant and clean way...

I did this:

        $options = array();
        $options['label'] = __('TestTest', true);
        if(!UserIsAuthed()) {
             $options['type'] = 'hidden';
        }

       echo $form->input('Model.field', $options);

This works fine, but I have to setup a new array for EVERY field of my
views...

I could do the whole array-setting in my controller, that would be
better I think but I'm startin' to wonder if there would be any chance
to do the check in the form-helper and append the "type" => "hidden"
option while the helper builds up the fields...

Or does anyone of you guys know a really good way to deal with
permissions of a user in a so detailed way that you can decide which
Form-Fields a logged in user can view or not? I already use ACL but if
I use the same action and the same view für multiple user-roles
(admin, user, guest...) I need to be able to control which role can
see what fields etc...

Regards,

DD


--~--~---------~--~----~------------~-------~--~----~
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