Suppose you log users in using the formula
<cflogin>
<cfloginuser>
</cflogin>
Suppose also that, in your Application file, you enabled
session management and set loginStorage to Sessions. Then,
throughout the user's session, the functions
getAuthUser()
and
isUserInRole("role_name")
will return values that match, respectively, the name and roles
attributes of the cfloginuser tag. You could then implement the
following kinds of filter on any page:
<cfif Len(getAuthUser()) NEQ 0>
<!--- code/functionality that requires that user be logged
in --->
</cfif>
<cfif getAuthUser() is "Jack">
<!--- code/functionality meant for Jack --->
</cfif>
<cfif Len(getAuthUser()) NEQ 0 and
isUserInRole("admin")>
<!--- code/functionality meant for admin users. Assumes
that roles
attribute of cfloginuser tag has value that includes admin,
for example,
"admin" or "admin,user". --->
</cfif>