Skip to the content
Documentation

user_role

No ratings yet

Summary

Fetches the policies that are available for a user.

Usage

fetch( 'user', 'user_role', hash( 'user_id', user_id ) )

Parameters

Name Type Description Required
user_id integer The user to fetch policies from Yes.

Returns

An array of hashes or FALSE.

Description

This function will fetch the policies that are available for a user. The desired user's ID number must be specified using the "id" parameter. The function will return an array of policy structures or FALSE if no policies are available or if a non-existing user ID number is provided. The following table shows the structure of the hashes that make up the elements of the returned array.

Name Type Description
moduleName string The name of the module that the user has access to (* means all modules).
functionName string The name of the function that the user has access to (* means all functions).
limitation string The elements of the module and function that the user has access to (* means no limitations).

Examples

Example 1

{def $policies=fetch( 'user', 'user_role', hash( 'user_id', 42 ) )}

{foreach $policies as $policy}
   {$policy.moduleName} /
   {$policy.functionName} /
   {$policy.limitation} <br />
{/foreach}

Outputs information about the policies that are available for user number 42.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.