I am probably doing this incorrectly.

I need to ensure indexed content types that have specific permissions
applied are not returned in the verity results if the users role does
not permit them to view. it. After much poking, trying to figure out
the best place t odo this, I settled on farVeritySearch.cfc (which has
a filterResults function)... I added the following code to it, and
while this seems towork (atleast on dev, against the dhtml collection)
its painfully slow. Is there something I can do to improve this code?

        <cffunction name="filterResults" access="public" output="false"
returntype="query" hint="Allows the developer to add a 2nd filter on
the results of the verity search">
                <cfargument name="objectid" required="true" hint="The objectid 
of
this verity search form object" />
                <cfargument name="qResults" required="true" hint="The initial
results of the search" />


        <!--- check view permissions --->
        <cfset var stVeritySearch = getData
(objectid="#arguments.objectid#")>
                <cfset var qFilter = queryNew("") />
                <cfset var qFilteredResults = queryNew("") />
        <cfset var UserRoles = application.security.getCurrentRoles() /
>
        <cfset var perm = "View" />
        <cfset var lhasView = "" />


        <!--- build a list of objectids the user may view --->
        <cfloop query="arguments.qResults">
          <cfif application.security.checkPermission
(permission=perm,object=arguments.qResults.objectid,role=UserRoles) EQ
1>
          <cfset lhasView = ListAppend
(lhasView,'#arguments.qResults.objectid#')>
          </cfif>
        </cfloop>

        <cfset QueryAddColumn
(qFilter,"objectid","cf_sql_varchar",ListtoArray(lhasView))>

                <cfquery dbtype="query" name="qFilteredResults">
                SELECT *
                FROM arguments.qResults
                WHERE objectid IN (<cfqueryparam cfsqltype="cf_sql_varchar"
list="true" value="#valueList(qFilter.objectid)#">)
                </cfquery>

        <cfreturn qFilteredResults />

</cffunction>
--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: [email protected]
To unsubscribe, email: [email protected]
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---

Reply via email to