From adb557d2c7471909bba8fc05dee9e875b7a079bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl> Date: Thu, 9 Nov 2006 21:25:24 +0000 Subject: [PATCH] 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 --- .../erp5_dms/DMS_getAdvancedSearchResults.xml | 38 +++++++++++-------- bt5/erp5_dms/bt/revision | 2 +- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_getAdvancedSearchResults.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_getAdvancedSearchResults.xml index 7ea06d939b..52054cf24b 100644 --- a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_getAdvancedSearchResults.xml +++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_getAdvancedSearchResults.xml @@ -100,6 +100,14 @@ modemap={\'natural\':0,\'boolean\':\'in_boolean_mode\',\'expanded\':\'with_query if mode and modemap.has_key(mode):\n args[\'search_mode\']=modemap[mode]\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 \n # a hack because SQLCatalog wants table.key now \n @@ -132,14 +140,14 @@ context.log(\'SEARCH:\',args)\n res=context.portal_catalog(**kw)\n \n # user wants only his documents\n -if args.get(\'mine\'): \n - context.log(\'mine\')\n - from AccessControl import getSecurityManager\n - sm=getSecurityManager()\n - u=sm.getUser()\n - # now we need to filter by owner\n - # some day we will do it in catalog\n - res=[r for r in res if u.allowed(r.getObject(),(\'Owner\',))]\n +#if args.get(\'mine\'): \n +# context.log(\'mine\')\n +# from AccessControl import getSecurityManager\n +# sm=getSecurityManager()\n +# u=sm.getUser()\n +# # now we need to filter by owner\n +# # some day we will do it in catalog\n +# res=[r for r in res if u.allowed(r.getObject(),(\'Owner\',))]\n \n #...and now we check for only the newest versions\n # but we need to preserve order\n @@ -231,24 +239,22 @@ return res\n <string>v</string> <string>mode</string> <string>modemap</string> + <string>AccessControl</string> + <string>getSecurityManager</string> + <string>sm</string> + <string>u</string> + <string>str</string> <string>cf</string> <string>ct</string> <string>mf</string> <string>mt</string> <string>wheres</string> - <string>str</string> <string>_apply_</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>newest</string> <string>counter</string> + <string>r</string> <string>ref</string> <string>int</string> <string>ver</string> diff --git a/bt5/erp5_dms/bt/revision b/bt5/erp5_dms/bt/revision index 5f1a9f39c2..9573848579 100644 --- a/bt5/erp5_dms/bt/revision +++ b/bt5/erp5_dms/bt/revision @@ -1 +1 @@ -324 \ No newline at end of file +326 \ No newline at end of file -- 2.30.9