Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 366

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Security test page</title>
</head>
<body>
<cfoutput>
<h2>Welcome #GetAuthUser()#!</h2>
</cfoutput>
ALL Logged-in Users see this message.<br>
<br>
<cfscript>
if (IsUserInRole("Human Resources"))
WriteOutput("Human Resources members see this message.<br><br>");
if (IsUserInRole("Documentation"))
WriteOutput("Documentation members see this message.<br><br>");
if (IsUserInRole("Sales"))
WriteOutput("Sales members see this message.<br><br>");
if (IsUserInRole("Manager"))
WriteOutput("Managers see this message.<br><br>");
if (IsUserInRole("Employee"))
WriteOutput("Employees see this message.<br><br>");
if (IsUserInRole("Contractor"))
WriteOutput("Contractors see this message.<br><br>");
</cfscript>
</body>
</html>
Reviewing the code
The following table describes the securitytest.cfm page CFML code and its function:
Code
<cfoutput>
<h2>Welcome #GetAuthUser()#!</h2>
</cfoutput>
ALL Logged-in Users see this message.<br>
<br>
<cfscript>
if (IsUserInRole("Human Resources"))
WriteOutput("Human Resources members see this
message.<br><br>");
if (IsUserInRole("Documentation"))
WriteOutput("Documentation members see this
message.<br><br>");
if (IsUserInRole("Sales"))
WriteOutput("Sales members see this
message.<br><br>");
if (IsUserInRole("Manager"))
WriteOutput("Managers see this message.<br><br>");
if (IsUserInRole("Employee"))
WriteOutput("Employees see this message.<br><br>");
if (IsUserInRole("Contractor"))
WriteOutput("Contractors see this
message.<br><br>");
</cfscript>
Description
Displays a welcome message that includes the user's login ID.
Displays this message in all cases. The page does not display until a
user is logged in.
Tests whether the user belongs to each of the valid roles. If the user is
in a role, displays a message with the role name.
Users see one message per role that they belong.
Last updated 1/20/2012
361

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents