Commit adb557d2 authored by Bartek Górny's avatar Bartek Górny

search "only my" documents by using Creator field

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11236 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 717f0ffd
...@@ -100,6 +100,14 @@ modemap={\'natural\':0,\'boolean\':\'in_boolean_mode\',\'expanded\':\'with_query ...@@ -100,6 +100,14 @@ modemap={\'natural\':0,\'boolean\':\'in_boolean_mode\',\'expanded\':\'with_query
if mode and modemap.has_key(mode):\n if mode and modemap.has_key(mode):\n
args[\'search_mode\']=modemap[mode]\n args[\'search_mode\']=modemap[mode]\n
\n \n
# user wants only his documents - we try to use Creator from compatibility table\n
if args.get(\'mine\'): \n
context.log(\'mine\')\n
from AccessControl import getSecurityManager\n
sm=getSecurityManager()\n
u=sm.getUser()\n
args[\'Creator\']=str(u)\n
\n
kw.update(args)\n kw.update(args)\n
\n \n
# a hack because SQLCatalog wants table.key now \n # a hack because SQLCatalog wants table.key now \n
...@@ -132,14 +140,14 @@ context.log(\'SEARCH:\',args)\n ...@@ -132,14 +140,14 @@ context.log(\'SEARCH:\',args)\n
res=context.portal_catalog(**kw)\n res=context.portal_catalog(**kw)\n
\n \n
# user wants only his documents\n # user wants only his documents\n
if args.get(\'mine\'): \n #if args.get(\'mine\'): \n
context.log(\'mine\')\n # context.log(\'mine\')\n
from AccessControl import getSecurityManager\n # from AccessControl import getSecurityManager\n
sm=getSecurityManager()\n # sm=getSecurityManager()\n
u=sm.getUser()\n # u=sm.getUser()\n
# now we need to filter by owner\n # # now we need to filter by owner\n
# some day we will do it in catalog\n # # some day we will do it in catalog\n
res=[r for r in res if u.allowed(r.getObject(),(\'Owner\',))]\n # res=[r for r in res if u.allowed(r.getObject(),(\'Owner\',))]\n
\n \n
#...and now we check for only the newest versions\n #...and now we check for only the newest versions\n
# but we need to preserve order\n # but we need to preserve order\n
...@@ -231,24 +239,22 @@ return res\n ...@@ -231,24 +239,22 @@ return res\n
<string>v</string> <string>v</string>
<string>mode</string> <string>mode</string>
<string>modemap</string> <string>modemap</string>
<string>AccessControl</string>
<string>getSecurityManager</string>
<string>sm</string>
<string>u</string>
<string>str</string>
<string>cf</string> <string>cf</string>
<string>ct</string> <string>ct</string>
<string>mf</string> <string>mf</string>
<string>mt</string> <string>mt</string>
<string>wheres</string> <string>wheres</string>
<string>str</string>
<string>_apply_</string> <string>_apply_</string>
<string>res</string> <string>res</string>
<string>AccessControl</string>
<string>getSecurityManager</string>
<string>sm</string>
<string>u</string>
<string>append</string>
<string>$append0</string>
<string>r</string>
<string>idx</string> <string>idx</string>
<string>newest</string> <string>newest</string>
<string>counter</string> <string>counter</string>
<string>r</string>
<string>ref</string> <string>ref</string>
<string>int</string> <string>int</string>
<string>ver</string> <string>ver</string>
......
324 326
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment