Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Auth_Acl_Ormacl::has_access()
  • It always returns false except you have 'ALL ACCESS' filter...

    I can not understand all design of this code, but I have found that this commit https://github.com/fuel/auth/commit/7187cc53c5d15079ddf795dfa0a5f06d8a215b95 has broken everything in our project... without that array_flip() it was working and I had in $current_rights var actions like Array                 (                     [0] => read                     [1] => add                     [2] => edit                     [3] => delete                 )
    but now we always have empty array()

    What's wrong with it?

  • PS: We upgraded to dev-1.9/develop due to support php8... but project could not take off (
  • Can anyone say is `actions` field format reglamented somewhere in `users_role_permissions` table? I think, it's supposed to be the same as `actions` field in `users_permissions` table, but in our project they are not match. Only order number used in `users_role_permissions`.`actions` so earlier it could be flipped, but `users_permissions` was not, so array_intersection_key worked. Now it looks like this:

    $permission->actions not flipped --> Array (     [0] => read     [1] => add     [2] => edit     [3] => delete )
    $rolepermission->actions not flipped --> Array (     [0] => 0     [1] => 1     [2] => 2     [3] => 3 )
    $permission->actions flipped --> Array (     [read] => 0     [add] => 1     [edit] => 2     [delete] => 3 )
    $rolePermission->actions flipped --> Array (     [0] => 0     [1] => 1     [2] => 2     [3] => 3 )

    So array_intersection_key of course is array().

    So is this actions format (with order numbers) our database designer invention?

  • The action list defined on a permission specify which possible
    actions can be assigned when assigning the permission to either a
    user, a group, or a role. The assigned actions are stored as an
    array of keys, that defines which of the actions were assigned.



    // if these are the possible actions:
    array('add', 'view', 'edit', 'delete')

    // then you should store this when assigning 'view' and 'edit':
    array(1, 2)

    From here https://fuelphp.com/dev-docs/packages/auth/ormauth/intro.html
  • I'll have to look into this, as your implementation on the surface looks fine.

    In the meantime, I wouid copy the ormacl class to your problem, overload the auth version, and revert that commit in your local copy, if that fixes it for you.

    That way you can move on with your project pending this issue.

Howdy, Stranger!

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

In this Discussion