Commit b9049dcc authored by Lucas Carvalho's avatar Lucas Carvalho

Added new bt5. After installing this bt5, the user management of your instance will be decoupled.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42988 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a9da6c93
from zLOG import LOG, WARNING
def Alarm_updatePersonModulePasswordInformation(self, **kw):
"""
Decoupling a TioLive Instance, we need to make sure that all the
users must have the password updated from TioLive Master.
"""
portal = self.getPortalObject()
person_list = portal.person_module.searchFolder(portal_type="Person",
reference="!= Null")
person_dict = {}
for person in person_list:
person_dict[person.getReference()] = person.getObject()
kw = dict(reference_list=person_dict.keys())
result = eval(portal.portal_wizard.callRemoteProxyMethod(
'WitchTool_getUserPasswordInformationDict',
use_cache=0,
ignore_exceptions=0,
**kw))
if result is None:
return False
for reference, password in result.iteritems():
person_dict[reference].password = password
return result.keys()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="Products.ERP5Type.Document.Alarm"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_senseDecoupleInstance</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>This alarm is used to decouple the user authentication of such TioLive Instance from TioLive Master.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>tiolive_decouple_user_authentication</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>10</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1293843660.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>solve_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>TioLive Decouple User Authentication</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<workflow_chain>
<chain>
<type>Assignment</type>
<workflow>-express_person_interaction_workflow</workflow>
</chain>
<chain>
<type>Person</type>
<workflow>-express_person_interaction_workflow</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>tiolive_decouple_instance</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
Call the scripts to decouple the TioLive Instance.\n
"""\n
from Products.ERP5Type.Log import log\n
log("Starting to decouple the TioLive Instance!")\n
\n
# Update person module.\n
result = context.Alarm_updatePersonModulePasswordInformation()\n
if not result:\n
log("TioLive Instance hasn\'t been decoupled with success! It could not update the objects from Person Module.")\n
return False\n
\n
# Disable the remove user creation.\n
if not context.Alarm_moveObsoleteSkinObjectList():\n
log("TioLive Instance hasn\'t been decoupled with success! It could not move the obsolete objects.")\n
return False\n
\n
# Remove Authentication Plugin\n
context.Alarm_removeAuthenticationPlugin()\n
context.setEnabled(False)\n
\n
# Notify customer\n
context.Alarm_notifyDecoupleInstance(person_list=result)\n
\n
log("Finished to decouple the TioLive Instance!")\n
\n
return True\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>Products.ERP5Type.Log</string>
<string>log</string>
<string>_getattr_</string>
<string>context</string>
<string>result</string>
<string>False</string>
<string>True</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_decoupleInstance</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
Decoupling the instance we need to move the Form used to create person\n
and also the script used.\n
\n
Those objects are customized into portal_skins/express_customization\n
and must be moved to tiolive_decouple_obsolete.\n
\n
The folder tiolive_decouple_obsolete is created only when it is required\n
and it is not present into portal skins selection.\n
"""\n
from Products.ERP5Type.Log import log\n
portal = context.getPortalObject()\n
obsolete_object_list = [\'Person_createUser\',\n
\'Person_viewCreateUserActionDialog\']\n
\n
express_customisation_folder = getattr(portal.portal_skins, "express_customisation", None)\n
if express_customisation_folder is None:\n
express_customisation_folder = getattr(portal.portal_skins, "express_customisation_user_synchronization", None)\n
if express_customisation_folder is None:\n
return True\n
\n
obsolete_skin_folder_id = "tiolive_decouple_obsolete"\n
obsolete_skin_folder = getattr(portal.portal_skins, obsolete_skin_folder_id, None)\n
if obsolete_skin_folder is None:\n
portal.portal_skins.manage_addFolder(id=obsolete_skin_folder_id)\n
\n
try:\n
object_list = express_customisation_folder.manage_cutObjects(obsolete_object_list)\n
portal.portal_skins[obsolete_skin_folder_id].manage_pasteObjects(object_list)\n
except AttributeError:\n
log(\'FAILED to move %s to %s skin folder. Please check is the objects are already into %s.\' % \\\n
(obsolete_object_list, obsolete_skin_folder_id, obsolete_skin_folder_id))\n
return False\n
\n
return True\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>Products.ERP5Type.Log</string>
<string>log</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>obsolete_object_list</string>
<string>getattr</string>
<string>None</string>
<string>express_customisation_folder</string>
<string>True</string>
<string>obsolete_skin_folder_id</string>
<string>obsolete_skin_folder</string>
<string>object_list</string>
<string>_getitem_</string>
<string>AttributeError</string>
<string>False</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_moveObsoleteSkinObjectList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
The customer must be notified about the decouple.\n
"""\n
mto = "tiolive-backup@tiolive.com"\n
mfrom = context.getPortalObject().email_from_address\n
subject = \'Your TioLive Instance has been decoupled from TioLive Master.\'\n
message = ["""\n
Your TioLive Instance have been decoupled from TioLive Master.\n
It means that all the user information has been moved to your instance and from now the user authentication will be done locally.\n
The user authentication will be much faster now.\n
\n
TioLive Instance Id: %s\n
\n
List of users which have been moved to your instance:\\n""" % context.ERP5Site_getExpressInstanceUid()]\n
\n
for person in person_list:\n
message.append(" %s\\n" % person)\n
\n
context.MailHost.send(\'\'.join(message), mto, mfrom, subject)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>person_list</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>person_list</string>
<string>mto</string>
<string>_getattr_</string>
<string>context</string>
<string>mfrom</string>
<string>subject</string>
<string>message</string>
<string>_getiter_</string>
<string>person</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_notifyDecoupleInstance</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
Script removes the nexedi_authentication plugin.\n
"""\n
plugin_id = "nexedi_authentication"\n
user_folder = context.getPortalObject().acl_users\n
user_folder.manage_delObjects(\'nexedi_authentication\')\n
\n
erp5_users_plugin = getattr(user_folder, "erp5_users")\n
erp5_users_plugin.manage_activateInterfaces(interfaces=[\'IAuthenticationPlugin\', \'IUserEnumerationPlugin\'])\n
\n
return True\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>plugin_id</string>
<string>_getattr_</string>
<string>context</string>
<string>user_folder</string>
<string>getattr</string>
<string>erp5_users_plugin</string>
<string>True</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_removeAuthenticationPlugin</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
Script check if nexedi_authentication exists.\n
"""\n
plugin_id = "nexedi_authentication"\n
user_folder = context.getPortalObject().acl_users\n
acl_users_id_list = user_folder.objectIds()\n
\n
if plugin_id in acl_users_id_list:\n
return context.Alarm_decoupleInstance()\n
\n
return False\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>plugin_id</string>
<string>_getattr_</string>
<string>context</string>
<string>user_folder</string>
<string>acl_users_id_list</string>
<string>False</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_senseDecoupleInstance</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>Alarm_updatePersonModulePasswordInformation</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>TioLiveDecoupleInstance</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_updatePersonModulePasswordInformation</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2011-01-18 lucas
- Initial version
\ No newline at end of file
2011 Nexedi SA
\ No newline at end of file
It must be installed only if you want to decouple such instance from TioLive Master.
Login will work locally.
\ No newline at end of file
Proprietary
\ No newline at end of file
14
\ No newline at end of file
TioLiveDecoupleInstance
\ No newline at end of file
portal_alarms/tiolive_decouple_user_authentication
\ No newline at end of file
Assignment | -express_person_interaction_workflow
Person | -express_person_interaction_workflow
\ No newline at end of file
tiolive_decouple_instance
\ No newline at end of file
tiolive_decouple_instance
\ 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