ISUSERINROLE  
Description

Determines whether an authenticated user belongs to the specified Role.

 
Returns

True, if the authenticated user, belongs to the specified Role; False, otherwise.

 
Category

Security functions, Decision functions

 
Function syntax
IsUserInRole("role_name")
 
See also

GetAuthUser, cflogin, cfloginuser; Chapter 16, "Securing Applications," in ColdFusion MX Developer's Guide

 
History

ColdFusion MX: Added this function.

 
Parameters

 
Usage

Role names are case-sensitive.

To check if a user is in multiple roles, specify them in a comma-delimited list, such as "Admin,HR". Lists with multiple roles cannot contain spaces as separators; for example, do not use "Admin, HR".

 
Example
<cfif IsUserInRole("Admin") > 
   <cfoutput>Authenticated user is an administrator</cfoutput> 
<cfelse IsUserInRole("User") > 
   <cfoutput>Authenticated user is a user</cfoutput> 
</cfif>

Name of a security role

ROLE_NAME