From a2fd7ad8fe18aeccc0e0b187ddaeab22d1fc8892 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 21 Jul 2010 14:33:08 +0000
Subject: [PATCH] honor property sheet's read_permission for preference tool
 accessors

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37218 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/PreferenceTool.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/product/ERP5Form/PreferenceTool.py b/product/ERP5Form/PreferenceTool.py
index a99245af0e..dac68c3703 100644
--- a/product/ERP5Form/PreferenceTool.py
+++ b/product/ERP5Form/PreferenceTool.py
@@ -30,6 +30,7 @@
 from AccessControl import ClassSecurityInfo
 from AccessControl.SecurityManagement import getSecurityManager,\
                           setSecurityManager, newSecurityManager
+from AccessControl.PermissionRole import  PermissionRole
 from MethodObject import Method
 from Products.ERP5Type.Globals import InitializeClass, DTMLFile
 from zLOG import LOG, PROBLEM
@@ -109,6 +110,10 @@ def createPreferenceToolAccessorList(portal) :
       for attribute_name in attr_list:
         method = PreferenceMethod(attribute_name, prop.get('default'))
         setattr(PreferenceTool, attribute_name, method)
+      read_permission = prop.get('read_permission')
+      if read_permission:
+        setattr(PreferenceTool, attribute_name + '__roles__',
+            PermissionRole(read_permission))
 
 
 class func_code: pass
-- 
2.30.9