Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How get all permissions assigned to a user
  • I know there are many way we can assign permission to user.
    By role. Direct. By group

    How I get aggregated permissions per user?

    Any help
  • The aggregated rights are calculated in the OrmAcl class, and cached there per user. As it is quite complex and time consuming, it isn't calculated for all users, but only for the user that logs in.
  • I am using angular app.. so as a user property response I need all permissions as a Jason to angular... So that dynamically I can show or hide options as per permission... How I get Json or Array of permissions and actions with true or false.
  • HarroHarro
    Accepted Answer
    If you only need it for the current logged-in user, your PHP code can call has_access() once, which will generate the cache file if it doesn't exist. After this, you can just read the cache file directly:

    $cache_key = \Config::get('ormauth.cache_prefix', 'auth').'.permissions.user_'.($user ? $user->id : 0);
    $acl_cache = \Cache::get($cache_key);
    list($current_rights, $revoked_rights, $global_access) = $acl_cache;

Howdy, Stranger!

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

In this Discussion