I wrote a little tag to do a "list_xand"; it returns the list of items that
are in both of two different lists. You could modify it, or use it as-is
and then do a listlen() to make sure that you didn't lose any privileges.
<cfsetting enablecfoutputonly="yes">
<!--- list_xand.cfm
Martin Herbener 8/4/1999
Template to take two lists and return a list
containing only the items
found in both lists.
attributes.first_list
attributes.second_list
attributes.varname (optional)
name to give return value, defaults to variables.list_xand
variables.shorter_list
variables.longer_list
variables.temp_list
--->
<cfparam name="attributes.varname" default="variables.list_xand">
<cfparam name="variables.temp_list" default="">
<cfif listlen(attributes.first_list) GT listlen(attributes.second_list)>
<Cfset variables.shorter_list = attributes.second_list>
<cfset variables.longer_list = attributes.first_list>
<cfelse>
<Cfset variables.shorter_list = attributes.first_list>
<cfset variables.longer_list = attributes.second_list>
</cfif>
<cfloop list="#variables.shorter_list#" index="variables.list_item">
<cfif listfind(variables.longer_list, variables.list_item) GT 0>
<cfset variables.temp_list = listappend(variables.temp_list,
variables.list_item)>
</cfif>
</cfloop>
<cfset "caller.#attributes.varname#" = variables.temp_list >
<cfsetting enablecfoutputonly="no">
-----Original Message-----
From: Ang�l Stewart [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 13, 2000 12:39 PM
To: [EMAIL PROTECTED]
Subject: Variable IN a list? How to check?
How would i write this correctly in CFML?
<Cfif #Deptid# IN #session.privileges#>
Of course I want to check if the list of values in DeptID are all included
in the list of values in the session.privileges list of values.
Sooo..
deptid may be "11001, 12000,13000"
and session.privileges may be :
"ViewReports,AddUsers,AddGroups,11001,12000,13000,14000,18201"
In this case, the DeptIDs are all found in the Priviliges list, so the user
is authorised.
Umm..is there a single tag to run this check?
-Gel
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message
to [EMAIL PROTECTED] with 'unsubscribe' in the body.