On 4/15/07, Mike Kear <[EMAIL PROTECTED]> wrote:
>         <cfset OkToGo = false />
> <cfloop list = "#UserPermissions#" index="i">
>    <cfset OkToGo = listfind(Permissionsrequired, "#i#") />
> </cfloop>
> <cfif OkToGo is false>
>         <cflocation addtoken="no" url="/index.cfm" />
>         <cfabort>
> </cfif>
>
> This all seems a bit clumsy to me but it will work.

Actually, no it won't. OkToGo will always end up set to the result of
searching for the *last* user permission. You need to add the
following, after the assignment to OkToGo inside your loop:

<cfif OkToGo>
    <cfbreak/>
</cfif>

Or, of course, you could change the code to this:

<cfloop list="#UserPermissions#" index="i">
    <cfif listfind(Permissionsrequired, i) neq 0>
        <cflocation addtoken="no" url="/index.cfm" />
        <cfabort>
    </cfif>
</cfloop>
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275257
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to