Assigning Security Roles To Component Functions; Handling Errors With Coldfusion - MACROMEDIA FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 Use Manual

Using flash remoting for flash mx 2004 actionscript 2.0
Table of Contents

Advertisement

<!--- Verify user name from cflogin.name and password from
cflogin.password
using your authentication mechanism. For example, you might store this
information in an LDAP database. --->
>
<cfif cflogin.name eq "bob">
<!--- In this example, bob is in the role of administrator. Typically, you
store user roles with authentication information. --->
<cfloginuser name="#cflogin.name#" password="#cflogin.password#"
roles="Admin">
</cfif>
</cflogin>
</cfsilent>
This example does not show how to perform user verification. For more information on
verification, see Developing ColdFusion MX Applications with CFML.

Assigning security roles to component functions

ColdFusion components offer roles-based security. The following example creates a component
method that deletes files:
<cfcomponent>
<cffunction name="deleteFile" access="remote" roles="admin,manager">
<cfargument name="filepath" required="yes">
<cffile action="DELETE" file=#arguments.filepath#>
</cffunction>
</cfcomponent>
In the example, the
to access it. In this example, only users in the admin and manager role can access the function.
Multiple roles are delimited with a comma.
In the Application.cfm file, you use the
a role. The user must be assigned to the correct role to access the component function. For more
information on roles, see Developing ColdFusion MX Applications with CFML.

Handling errors with ColdFusion

ColdFusion pages and components can return error information to a Flash application if the
ColdFusion code fails. For example, the following Flash application calls a ColdFusion page
named causeError.cfm:
import mx.remoting.Service;
//...
var CFMService:Service = new Service(
"http://localhost/flashservices/gateway",
null,
"errorExample",
null,
null);
CFMService.causeError();
tag includes the
cffunction
cfloginuser
attribute to specify the user roles allowed
roles
tag to log in the user and assign the user to

Handling errors with ColdFusion

117

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash remoting mx

Table of Contents