Adobe ColdFusion 8

IsUserInAnyRole

Description

Determines whether an authenticated user belongs to any Role.

Returns

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

Category

Security functions, Decision functions

Function syntax

IsUserInAnyRole()

See also

cflogin, cfloginuser, cflogout, GetAuthUser, GetUserRoles, IsUserInRole, IsUserLoggedIn, "Securing Applications" in the ColdFusion Developer's Guide

History

ColdFusion 8: Added this function.

Usage

Role names are not 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 IsUserInAnyRole() > 
    <cfoutput>Authenticated user is in these roles: #GetUserRoles()#</cfoutput> 
<cfelseif > 
    <cfoutput>Authenticated user is in no roles</cfoutput> 
</cfif>