Contents > CFML Reference > ColdFusion Functions > IsUserInRole PreviousNext

IsUserInRole

Determines whether an authenticated user belongs to the specified Role.

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

Authentication functions, Decision functions

IsUserInRole("role_name")

GetAuthUser, cflogin, cfloginuser, Securing Applications in Developing ColdFusion MX Applications

ColdFusion MX: Added this function.

Parameter

Description

role_name

Name of a security role

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".

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

Contents > CFML Reference > ColdFusion Functions > IsUserInRole PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.