Introduction
============
This product allows migrating various user specific data associated with a
principal ID (user or group) to an other principal ID. It's especially useful
if IDs have to be renamed.
Currently the following user data can be migrated:
- Users (ZODB User Manager)
- User Properties (ZODB Mutable Property Provider)
- Group Members
- Local Roles
- Dashboards
- Home Folders
Installation
============
Add ``ftw.usermigration`` to the list of eggs in your buildout.
Then rerun buildout and restart your instance.
Usage
=====
Open ``@@user-migration`` in your browser.
Registering principal mappings
------------------------------
If you would like to provide the principal mapping in a programmatic way
instead of entering it through-the-web, you can register one or more named
adapters that implement ``IPrincipalMappingSource``.
Example:
.. code:: python
class MigrationMapping(object):
def __init__(self, portal, request):
self.portal = portal
self.request = request
def get_mapping(self):
mapping = {'old_user': 'new_user',
'old_group': 'new_group'}
return mapping
ZCML:
.. code:: xml
<adapter
factory="my.package.migration.MigrationMapping"
provides="ftw.usermigration.interfaces.IPrincipalMappingSource"
for="Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot
zope.publisher.interfaces.browser.IBrowserRequest"
name="ad-migration-2015"
/>
This will result in this mapping being selectable as a mapping source with the
name ``ad-migration-2015`` in the ``@@user-migration`` form.
Registering pre- and post-migration hooks
-----------------------------------------
If you want to provide your own code that runs before or after any of the
built-in migration types in ``ftw.usermigration``, you can do so by registering
hooks that implement the ``IPreMigrationHook`` or ``IPostMigrationHook`` interface.
Example:
.. code:: python
class ExamplePreMigrationHook(object):
def __init__(self, portal, request):
self.portal = portal
self.request = request
def execute(self, principal_mapping, mode):
# ...
# your code here
# ...
results = {
'Step 1': {
'moved': [('/foo', 'old', 'new')],
'copied': [],
'deleted': []},
'Step 2': {
'moved': [('/bar', 'old', 'new')],
'copied': [],
'deleted': []},
}
return results
A hook adapter's ``execute()`` method receives the ``principal_mapping`` and
``mode`` as arguments.
Its results are expected to be a dict of dicts: The outer
dictionary allows for a hook to group several steps it executes and
report their results separately. The inner dictionary follows the same
structure as the results of the built-in migrations.
ZCML:
.. code:: xml
<adapter
factory=".migrations.ExamplePreMigrationHook"
provides="ftw.usermigration.interfaces.IPreMigrationHook"
for="Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot
zope.publisher.interfaces.browser.IBrowserRequest"
name="example-pre-migration-hook"
/>
Links
=====
- Main github project repository:
https://github.com/4teamwork/ftw.usermigration
- Issue tracker:
https://github.com/4teamwork/ftw.usermigration/issues
- Pypi: http://pypi.python.org/pypi/ftw.usermigration
- Continuous integration: https://jenkins.4teamwork.ch/search?q=ftw.usermigration
Copyright
=========
This package is copyright by `4teamwork <http://www.4teamwork.ch/>`_.
``ftw.usermigration`` is licensed under GNU General Public License, version 2.
Changelog
=========
1.3.0 (2023-01-23)
------------------
- Add Support for Python 3 and Plone 5.2. [lgraf]
- Add Plone 5.1 compatibility. [phgross]
- Drop Plone 4.2 compatibility. [phgross]
1.2.0 (2017-05-01)
------------------
- Implement loginnames migration step [elioschmutz]
- Fix migrating users whose username is the beginning of another username [elioschmutz]
- Implement group members migration [elioschmutz]
- Drop Plone 4.1 support. [jone]
1.1 (2015-04-17)
----------------
- Add option to only display a summary of the migration results.
[lgraf]
- Add logging of detailed migration results to logfile (optional).
[lgraf]
- Add migration for global roles (portal_role_manager).
[lgraf]
- Add support for pre- and post-migration hooks.
[lgraf]
- Make sure `Migrations` field always uses the CheckBoxFieldWidget.
[lgraf]
- Use transaction.doom() for dry runs.
This ensures that even an accidental commit() can't result in a DB write.
[lgraf]
- Add support for programmatically providing principal mappings
by registering an IPrincipalMappingSource named adapter.
[lgraf]
- Rename `user` to `principal` where applicable:
Most of the operations work for groups as well as for users.
Therefore the mapping can contain principal IDs, not just
user IDs.
[lgraf]
1.0 (2014-06-16)
----------------
- Initial release
Raw data
{
"_id": null,
"home_page": "https://github.com/4teamwork/ftw.usermigration",
"name": "ftw.usermigration",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Thomas Buchberger",
"author_email": "t.buchberger@4teamwork.ch",
"download_url": "https://files.pythonhosted.org/packages/3b/1c/023a1cfffb1da05720b3f26f43f1e54110ceb76aee45f11a10cbf0be2073/ftw.usermigration-1.3.0.tar.gz",
"platform": null,
"description": "Introduction\n============\n\nThis product allows migrating various user specific data associated with a\nprincipal ID (user or group) to an other principal ID. It's especially useful\nif IDs have to be renamed.\n\nCurrently the following user data can be migrated:\n\n- Users (ZODB User Manager)\n\n- User Properties (ZODB Mutable Property Provider)\n\n- Group Members\n\n- Local Roles\n\n- Dashboards\n\n- Home Folders\n\n\nInstallation\n============\n\nAdd ``ftw.usermigration`` to the list of eggs in your buildout.\nThen rerun buildout and restart your instance.\n\n\nUsage\n=====\n\nOpen ``@@user-migration`` in your browser.\n\nRegistering principal mappings\n------------------------------\n\nIf you would like to provide the principal mapping in a programmatic way\ninstead of entering it through-the-web, you can register one or more named\nadapters that implement ``IPrincipalMappingSource``.\n\nExample:\n\n.. code:: python\n\n\tclass MigrationMapping(object):\n\n\t def __init__(self, portal, request):\n\t self.portal = portal\n\t self.request = request\n\n\t def get_mapping(self):\n\t mapping = {'old_user': 'new_user',\n\t 'old_group': 'new_group'}\n\t return mapping\n\nZCML:\n\n.. code:: xml\n\n <adapter\n factory=\"my.package.migration.MigrationMapping\"\n provides=\"ftw.usermigration.interfaces.IPrincipalMappingSource\"\n for=\"Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot\n zope.publisher.interfaces.browser.IBrowserRequest\"\n name=\"ad-migration-2015\"\n />\n\nThis will result in this mapping being selectable as a mapping source with the\nname ``ad-migration-2015`` in the ``@@user-migration`` form.\n\nRegistering pre- and post-migration hooks\n-----------------------------------------\n\nIf you want to provide your own code that runs before or after any of the\nbuilt-in migration types in ``ftw.usermigration``, you can do so by registering\nhooks that implement the ``IPreMigrationHook`` or ``IPostMigrationHook`` interface.\n\nExample:\n\n.. code:: python\n\n class ExamplePreMigrationHook(object):\n\n def __init__(self, portal, request):\n self.portal = portal\n self.request = request\n\n def execute(self, principal_mapping, mode):\n # ...\n # your code here\n # ...\n results = {\n 'Step 1': {\n 'moved': [('/foo', 'old', 'new')],\n 'copied': [],\n 'deleted': []},\n 'Step 2': {\n 'moved': [('/bar', 'old', 'new')],\n 'copied': [],\n 'deleted': []},\n }\n return results\n\nA hook adapter's ``execute()`` method receives the ``principal_mapping`` and\n``mode`` as arguments.\n\nIts results are expected to be a dict of dicts: The outer\ndictionary allows for a hook to group several steps it executes and\nreport their results separately. The inner dictionary follows the same\nstructure as the results of the built-in migrations.\n\n\nZCML:\n\n.. code:: xml\n\n <adapter\n factory=\".migrations.ExamplePreMigrationHook\"\n provides=\"ftw.usermigration.interfaces.IPreMigrationHook\"\n for=\"Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot\n zope.publisher.interfaces.browser.IBrowserRequest\"\n name=\"example-pre-migration-hook\"\n />\n\n\nLinks\n=====\n\n- Main github project repository:\n https://github.com/4teamwork/ftw.usermigration\n- Issue tracker:\n https://github.com/4teamwork/ftw.usermigration/issues\n- Pypi: http://pypi.python.org/pypi/ftw.usermigration\n- Continuous integration: https://jenkins.4teamwork.ch/search?q=ftw.usermigration\n\n\nCopyright\n=========\n\nThis package is copyright by `4teamwork <http://www.4teamwork.ch/>`_.\n\n``ftw.usermigration`` is licensed under GNU General Public License, version 2.\n\nChangelog\n=========\n\n1.3.0 (2023-01-23)\n------------------\n\n- Add Support for Python 3 and Plone 5.2. [lgraf]\n\n- Add Plone 5.1 compatibility. [phgross]\n\n- Drop Plone 4.2 compatibility. [phgross]\n\n\n1.2.0 (2017-05-01)\n------------------\n\n- Implement loginnames migration step [elioschmutz]\n\n- Fix migrating users whose username is the beginning of another username [elioschmutz]\n\n- Implement group members migration [elioschmutz]\n\n- Drop Plone 4.1 support. [jone]\n\n\n1.1 (2015-04-17)\n----------------\n\n- Add option to only display a summary of the migration results.\n [lgraf]\n\n- Add logging of detailed migration results to logfile (optional).\n [lgraf]\n\n- Add migration for global roles (portal_role_manager).\n [lgraf]\n\n- Add support for pre- and post-migration hooks.\n [lgraf]\n\n- Make sure `Migrations` field always uses the CheckBoxFieldWidget.\n [lgraf]\n\n- Use transaction.doom() for dry runs.\n This ensures that even an accidental commit() can't result in a DB write.\n [lgraf]\n\n- Add support for programmatically providing principal mappings\n by registering an IPrincipalMappingSource named adapter.\n [lgraf]\n\n- Rename `user` to `principal` where applicable:\n Most of the operations work for groups as well as for users.\n Therefore the mapping can contain principal IDs, not just\n user IDs.\n [lgraf]\n\n\n1.0 (2014-06-16)\n----------------\n\n- Initial release",
"bugtrack_url": null,
"license": "GPL",
"summary": "User migration for Plone",
"version": "1.3.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3b1c023a1cfffb1da05720b3f26f43f1e54110ceb76aee45f11a10cbf0be2073",
"md5": "0a4824bbd254db9ac763a2d3b6ed1e04",
"sha256": "ad93ecabb2be92a55901eb6b7d53068086d3c059fe2d900d0f8df3f2073b4742"
},
"downloads": -1,
"filename": "ftw.usermigration-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "0a4824bbd254db9ac763a2d3b6ed1e04",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 29430,
"upload_time": "2023-01-23T12:46:27",
"upload_time_iso_8601": "2023-01-23T12:46:27.365181Z",
"url": "https://files.pythonhosted.org/packages/3b/1c/023a1cfffb1da05720b3f26f43f1e54110ceb76aee45f11a10cbf0be2073/ftw.usermigration-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-23 12:46:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "4teamwork",
"github_project": "ftw.usermigration",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ftw.usermigration"
}