Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Listing Role actions OrmAuth
  • Hello.

    Well i was trying to list the actions permissions that a given user has... it would be easy as do

    $role->permissions and loop over it... but when trying to show the actions... it obviously shows the actions of each permission but not the actions the role has.. so i made this (based on the ormacl)


    But... i achieved it within my view, which i know it a bad practice to have this logic within the view...


    So, i have 2 questions:

    1. Is this aproach a good one to list the actions of a given role?
    2. how to do it within the controller or viewmodel to just echo the results within the view?

    Thank you in advanced
  • HarroHarro
    Accepted Answer
    In our app framework, permissions are added automatically by modules, and are linked to language strings to give a localized description of the permission.

    We do it in a Viewmodel, which constructs an array ordered by translated actions / permissions, and contains an array with all actions with a true/false to drive the checkboxes in the view. The view just iterates over the array producing this: http://i.imgur.com/ntybs3z.png

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion