[Erp5-report] r36493 mohamadou - in /erp5/trunk/bt5/erp5_egov: ExtensionTemplateItem/ bt/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jun 22 01:00:23 CEST 2010


Author: mohamadou
Date: Tue Jun 22 01:00:23 2010
New Revision: 36493

URL: http://svn.erp5.org?rev=36493&view=rev
Log:
2010-06-21 mohamadou
* add SetUpEGovInstance Extension, to use Egov User and Group Manager and to enable some procedure log in.

Added:
    erp5/trunk/bt5/erp5_egov/ExtensionTemplateItem/SetUpEGovInstance.py
Modified:
    erp5/trunk/bt5/erp5_egov/bt/change_log
    erp5/trunk/bt5/erp5_egov/bt/revision
    erp5/trunk/bt5/erp5_egov/bt/template_extension_id_list

Added: erp5/trunk/bt5/erp5_egov/ExtensionTemplateItem/SetUpEGovInstance.py
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_egov/ExtensionTemplateItem/SetUpEGovInstance.py?rev=36493&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_egov/ExtensionTemplateItem/SetUpEGovInstance.py (added)
+++ erp5/trunk/bt5/erp5_egov/ExtensionTemplateItem/SetUpEGovInstance.py [utf8] Tue Jun 22 01:00:23 2010
@@ -0,0 +1,116 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2010 Nexedi SARL and Contributors. All Rights Reserved.
+#                 Mohamadou Mbengue <mayoro at gmail.com>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+##############################################################################
+
+from Testing import ZopeTestCase
+from Products import ERP5Security
+from Products import PluggableAuthService
+
+def enableEgovProcedureLogin(self, portal_type):
+  '''
+  set properties to enable the login on Person and Organisation
+  and subcription forms (citizen, company, agent)
+  '''
+  portal = self.getPortalObject()
+
+  def getAclUsers(self):
+    return getattr(self.getPortalObject(), 'acl_users', None)
+  acl_users = getAclUsers(self)
+  erp5security_dispatcher = acl_users.manage_addProduct['ERP5eGovSecurity']
+  # add the portal_type in Egov portal_type_list
+  if {'meta_type': 'EGOV User Manager', 'id': 'egov_users'} in \
+      erp5security_dispatcher._d._objects:
+    ptype_list = acl_users.egov_users.portal_type_list
+    if not portal_type in ptype_list:
+      ptype_list = ptype_list + (portal_type,)
+      acl_users.egov_users.manage_changeProperties(portal_type_list=ptype_list,)
+  if {'meta_type': 'EGOV Group Manager', 'id': 'egov_groups'} in \
+      erp5security_dispatcher._d._objects :
+    ptype_list = acl_users.egov_groups.portal_type_list
+    if not portal_type in ptype_list:
+      ptype_list = ptype_list + (portal_type,)
+  return '- %s Login Enabled' % portal_type
+
+def setUpEGovSecurityManager(self):
+  '''use safi PAS to be able to login organisation'''
+
+  portal = self.getPortalObject()
+
+  def getAclUsers(self):
+    return getattr(self.getPortalObject(), 'acl_users', None)
+
+  acl_users = getAclUsers(self)
+
+  # Add EGOVUserManager
+  ZopeTestCase.installProduct('EGOVSecurity')
+  erp5security_dispatcher = acl_users.manage_addProduct['ERP5eGovSecurity']
+  # don't add it if it's already here
+  if {'meta_type': 'EGOV User Manager', 'id': 'egov_users'} not in \
+      erp5security_dispatcher._d._objects:
+    erp5security_dispatcher.addEGOVUserManager('egov_users')
+  if {'meta_type': 'EGOV Group Manager', 'id': 'egov_groups'} not in \
+      erp5security_dispatcher._d._objects :
+    erp5security_dispatcher.addEGOVGroupManager('egov_groups')
+  # Register ERP5UserManager Interface
+  acl_users.egov_users.manage_activateInterfaces(('IAuthenticationPlugin',
+                                                  'IUserEnumerationPlugin',))
+  acl_users.egov_groups.manage_activateInterfaces(('IGroupsPlugin',))
+
+  # desactivate the erp5 plugin
+  plugins = acl_users.egov_groups.plugins
+  interface = plugins._getInterfaceFromName('IGroupsPlugin')
+  if 'erp5_groups' in list(plugins._getPlugins(interface)):
+    plugins.deactivatePlugin( interface, 'erp5_groups')
+  plugins = acl_users.egov_users.plugins
+  interface = plugins._getInterfaceFromName('IAuthenticationPlugin')
+  if 'erp5_users' in list(plugins._getPlugins(interface)):
+    plugins.deactivatePlugin( interface, 'erp5_users')
+  interface = plugins._getInterfaceFromName('IUserEnumerationPlugin')
+  if 'erp5_users' in list(plugins._getPlugins(interface)):
+    plugins.deactivatePlugin( interface, 'erp5_users')
+
+  # set properties to enable the login on Person and Organisation
+  # and subcription forms (citizen, company, agent)
+  acl_users.egov_users.manage_changeProperties(portal_type_list=[
+                                                      'Person',
+                                                      'Organisation'],)
+  acl_users.egov_groups.manage_changeProperties(portal_type_list=[
+                                                      'Person',
+                                                      'Organisation'],)
+  return '- EGOV security set up completed'
+
+
+def setUpInstance(self):
+  '''call all other set up method to prepare the site for eGOV Instance'''
+  message_list = []
+  message_list.append(setUpEGovSecurityManager(self))
+
+  message_list.append('')
+  message_list.append('Set Up sequence completed')
+  return '\n'.join(message_list)
+

Modified: erp5/trunk/bt5/erp5_egov/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_egov/bt/change_log?rev=36493&r1=36492&r2=36493&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_egov/bt/change_log [utf8] (original)
+++ erp5/trunk/bt5/erp5_egov/bt/change_log [utf8] Tue Jun 22 01:00:23 2010
@@ -1,4 +1,7 @@
 2010-06-21 mohamadou
+* add SetUpEGovInstance Extension, to use Egov User and Group Manager and to enable some procedure log in.
+
+2010-06-21 mohamadou
 * add publication section in erp5_egov  Assignment _view
 
 2010-06-21 mohamadou

Modified: erp5/trunk/bt5/erp5_egov/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_egov/bt/revision?rev=36493&r1=36492&r2=36493&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_egov/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_egov/bt/revision [utf8] Tue Jun 22 01:00:23 2010
@@ -1 +1 @@
-569
\ No newline at end of file
+573
\ No newline at end of file

Modified: erp5/trunk/bt5/erp5_egov/bt/template_extension_id_list
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_egov/bt/template_extension_id_list?rev=36493&r1=36492&r2=36493&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_egov/bt/template_extension_id_list [utf8] (original)
+++ erp5/trunk/bt5/erp5_egov/bt/template_extension_id_list [utf8] Tue Jun 22 01:00:23 2010
@@ -1,3 +1,4 @@
 Captcha
 ERP5EGov_Extensions
-EGovSecurity
\ No newline at end of file
+EGovSecurity
+SetUpEGovInstance
\ No newline at end of file




More information about the Erp5-report mailing list