Misleading docs for isUserInAnyRole

This post is more than 2 years old.

I just helped someone out on the BACFUG list concerning a misleading doc page for isUserInAnyRole().

The docs mention that you can use the function to test and see if a user is in one of a list of roles, but it also implies you can use it to see if a user has any roles at all:

<cfif IsUserInAnyRole() > <cfoutput>Authenticated user is in these roles: #GetUserRoles()#</cfoutput> <cfelseif > <cfoutput>Authenticated user is in no roles</cfoutput> </cfif>

This code won't run as isUserInAnyRole must have at least one argument, which is a list of roles to check against the user. Here is an example showing correct usage. The output will be YES.

<cfloginuser name="ray" password="parishilton" roles="a,b">


I posted a comment to Livedocs, but I don't see it online yet.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for HERE Technologies. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com