Skip to content

Authorization library

Jakub edited this page Jan 12, 2014 · 2 revisions

This library will allow you to check if a user has authorization to access given features. You need to establish permission in administration.

is_permitted($permission_keys, $require_all = FALSE)

$permission_keys - accepts both string and array. This should be the permission name that you created in administration or array of permission names. $require_all - if you are entering an array you can set this to TRUE so that in order for the user to have right to access given functionality they need to have all the permissions in the array. Returns boolean.

is_admin()

Will check if the user is assigned admin role. Returns boolean.

is_role($role)

Will check if the user is certain role. Returns boolean.