From 4c1008f51f8a955fa80b82cf957ededf5fe78d94 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Fri, 23 Sep 2005 13:12:50 +0000
Subject: [PATCH] Secutiry update :

If we decide in the security script that we don't want to update the
assigned roles for this object, we can just have it return None instead of
a dict or list of dicts.

This may happen for example when a site manager creates a new object.


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

diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py
index 4b842e313d..6182e17558 100755
--- a/product/ERP5Type/ERP5Type.py
+++ b/product/ERP5Type/ERP5Type.py
@@ -228,6 +228,10 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
                     if base_category_script is not None:
                         # call the script, which should return either a dict or a list of dicts
                         category_result = base_category_script(actual_base_category_list, user_name, object, object.getPortalType())
+                        # If we decide in the script that we don't want to update the security for this object,
+                        # we can just have it return None instead of a dict or list of dicts
+                        if category_result is None:
+                            return
                         if type(category_result) is type({}):
                             category_result = [category_result]
                     else:
-- 
2.30.9