Commit cc5f6a48 authored by Yusei Tahara's avatar Yusei Tahara

By default, all formats are permitted to convert for everyone.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18471 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6ba190da
...@@ -66,34 +66,42 @@ ...@@ -66,34 +66,42 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""\n <value> <string>"""\n
A very simple implementation which makes sure\n This script provides a facility to permit conversion by format.\n
that pure auditors can only view in non editable formats\n
(pdf, html, txt, png, etc.)\n
"""\n """\n
from AccessControl import getSecurityManager\n #\n
user = getSecurityManager().getUser()\n # By default, all formats are permitted.\n
role_list = user.getRolesInContext(context)\n #\n
return 1\n
\n \n
# Users involved in the document may view it in editable mode\n
if "Associate" in role_list or "Assignee" in role_list or\\\n
"Assignor" in role_list or "Manager" in role_list or "Owner" in role_list:\n
return 1\n
\n \n
# Reject original format\n ###\n
if format is None:\n ### Below is an example which pure auditors can only view in non editable\n
return 0\n ### formats (pdf, html, txt, png, etc.)\n
\n ###\n
# All users with view permission may view the document \n ## from AccessControl import getSecurityManager\n
# in read only mode\n ## user = getSecurityManager().getUser()\n
if format in (\'html\', \'stripped-html\', \'text\', \'txt\', \'pdf\', \'png\', \'jpg\', \'gif\'):\n ## role_list = user.getRolesInContext(context)\n
return 1\n ## \n
if format.endswith(\'pdf\'):\n ## # Users involved in the document may view it in editable mode\n
return 1\n ## if "Associate" in role_list or "Assignee" in role_list or\\\n
if format.endswith(\'html\'):\n ## "Assignor" in role_list or "Manager" in role_list or "Owner" in role_list:\n
return 1\n ## return 1\n
\n ##\n
# All other formats are prohibitted\n ## # Reject original format\n
return 0\n ## if format is None:\n
## return 0\n
##\n
## # All users with view permission may view the document \n
## # in read only mode\n
## if format in (\'html\', \'stripped-html\', \'text\', \'txt\', \'pdf\', \'png\', \'jpg\', \'gif\'):\n
## return 1\n
## if format.endswith(\'pdf\'):\n
## return 1\n
## if format.endswith(\'html\'):\n
## return 1\n
##\n
## # All other formats are prohibitted\n
## return 0\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -143,13 +151,6 @@ return 0\n ...@@ -143,13 +151,6 @@ return 0\n
<value> <value>
<tuple> <tuple>
<string>format</string> <string>format</string>
<string>AccessControl</string>
<string>getSecurityManager</string>
<string>_getattr_</string>
<string>user</string>
<string>context</string>
<string>role_list</string>
<string>None</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
786 787
\ 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