Commit 7110bf22 authored by Romain Courteaud's avatar Romain Courteaud

Do not propose to user to add new objects, if he doesn't have the permission to

do it.
This should not have impact on performance, as this menu is rarely displayed.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18644 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bb279cf3
......@@ -39,6 +39,8 @@ from types import StringType
from zLOG import LOG
from Products.Formulator.DummyField import fields
from Globals import get_request
from AccessControl import Unauthorized
from AccessControl import getSecurityManager
# Max. number of catalog result
MAX_SELECT = 30
......@@ -707,8 +709,16 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator):
menu_item_list.append(('', ''))
# If the length is 0, raise an error
if field.get_value('allow_creation') == 1 :
user = getSecurityManager().getUser()
getDefaultModule = field.getDefaultModule
# XXX
for portal_type in portal_type_list:
try:
module = getDefaultModule(portal_type)
except ValueError:
pass
else:
if portal_type in module.getVisibleAllowedContentTypeList():
translated_portal_type = Message(domain='erp5_ui',
message=portal_type)
message = Message(
......
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