You would probably get better results with a direct query to the database
for the permissions. Something like
select referenceid
from  farBarnacle b
where b.roleid in (<cfqueryparam cfsqltype="cf_sql_varchar" list="true"
value="#application.security.getCurrentRoles()#" />
and referenceid in (<cfqueryparam cfsqltype="cf_sql_varchar" list="true"
value="#valuelist(arguments.qResults.objectid)#" />
and permissionid = <cfqueryparam cfsqltype="cf_sql_varchar"
value="#application.security.factory.permission.getID('View')#" />
and barnaclevalue = 1

That should return those objectid's that the current user has the view
permission for. Keep in mind that this wouldn't be enough for dmNavigation -
in that case you would also need to check for barnaclevalue = 0 and do the
checkPermission call for those.

Blair

On Wed, Jun 17, 2009 at 9:59 AM, Chris Roth <[email protected]> wrote:

>
> 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