Changes between Version 17 and Version 18 of TracUserSyncPlugin


Ignore:
Timestamp:
Aug 27, 2015, 11:55:27 AM (9 years ago)
Author:
figaro
Comment:

Cosmetic changes, reduced indemnifying language, tagged with license

Legend:

Unmodified
Added
Removed
Modified
  • TracUserSyncPlugin

    v17 v18  
    1 = Synchronize User Account data between multiple Trac projects =
    2 [[TOC]]
     1[[PageOutline(2-5,Contents,pullout)]]
     2
     3= Synchronize User Account data between multiple Trac projects
    34
    45{{{
     
    910}}}
    1011
    11 == Description ==
    12 This plugin can be used to synchronize user account data between multiple projects within the same `TRAC_PARENT`. Basically, it reads the account information from all the separate environments, merges them, and then updates all environments accordingly. As it currently still is in early beta state at best, a `dryrun` mode is enabled by default - so no changes will be written to the database. Instead, the updates for the affected environments will be stored in `<tracenv>.sql` files to investigate.
     12== Description
    1313
    14 If you intend to use this plugin in its current state, you are strongly encouraged to...
     14This plugin can be used to synchronize user account data between multiple projects within the same `TRAC_PARENT`. It reads the account information from all the separate environments, merges them, and then updates all environments accordingly. As it currently still is in early beta state at best, a `dryrun` mode is enabled by default - so no changes will be written to the database. Instead, the updates for the affected environments will be stored in `<tracenv>.sql` files to investigate.
     15
     16If you intend to use this plugin in its current state, you are strongly encouraged to:
    1517 1. first test it in a non-productive environment, best is a copy of the intended productive environment to be used on later
    1618 1. first let it run in `drymode`, and investigate the resulting `*.sql` files carefully (see [#Usage below])
     
    1820 1. only if still everything seems to be OK, repeat these steps in your productive environment - at your own risk
    1921
    20 I (the author) will take no responsibilities whatever, especially concerning possible damage and data loss. You have been warned!
    21 
    2222If you are still eager to try it: Great - I love to receive your feedback!
    2323
    24 == Limitations ==
     24=== Limitations
     25
    2526Except this plugin being still in early beta state, there are more limitations to consider:
    2627 1. it was not widely tested yet
    2728 1. it is not yet "fool-proof" (if it ever will be). This especially means, not all possible exceptions may be handled yet
    28  1. it works only for environments, which...
     29 1. it works only for environments, which meet the following conditions:
    2930  1. share the same `TRAC_PARENT_DIR`
    3031  1. use the AccountManagerPlugin
    3132  1. store the user passwords in a `.htpasswd` file
    3233  1. share the same `.htpasswd` password file
    33 There may be more limitations I'm not aware of at the moment...
    3434
    35 == Bugs/Feature Requests ==
     35== Bugs/Feature Requests
    3636
    3737Existing bugs and feature requests for TracUserSyncPlugin are
     
    3939
    4040If you have any issues, create a
    41 [http://trac-hacks.org/newticket?component=TracUserSyncPlugin&owner=izzy new ticket].
     41[/newticket?component=TracUserSyncPlugin new ticket].
    4242
    43 == Download ==
     43[[TicketQuery(component=TracUserSyncPlugin&group=type,format=progress)]]
     44
     45== Download
    4446
    4547Download the zipped source from [download:tracusersyncplugin here].
    4648
    47 == Source ==
     49== Source
    4850
    4951You can check out TracUserSyncPlugin from [http://trac-hacks.org/svn/tracusersyncplugin here] using Subversion, or [source:tracusersyncplugin browse the source] with Trac.
    5052
    51 == Versions ==
     53=== Versions
     54
    5255 * [http://trac-hacks.org/svn/tracusersyncplugin/0.11/branches/0.1 0.1]: Basic synchronization
    5356 * [http://trac-hacks.org/svn/tracusersyncplugin/0.11/trunk current trunk]: adds purge functionality
    5457
    55 == Installation ==
     58== Installation
     59
    5660The easiest way to install this plugin is:
    57 {{{
     61{{{#!sh
    5862easy_install http://trac-hacks.org/svn/tracusersyncplugin/0.11/trunk
    5963}}}
     64
    6065While you may want to replace "trunk" by one of the branches. "trunk" is usually the "code in development", while the branches should reflect something "stable".
    6166
    6267You can also checkout the code from the repository, or download and unpack the zipped source (see above) - and then run either `easy_install` or `python setup.py` from where the `setup.py` file resides.
    6368
    64 == Configuration ==
     69== Configuration
     70
    6571First you of course need to activate the plugin. This is, as usual, done in the components section of your `trac.ini`:
    66 {{{
     72{{{#!ini
    6773[components]
    6874tracusersync.* = enabled
    6975}}}
    7076
    71 For testing purposes, default settings should be fine. However, there are some settings you can use for "fine-tuning" - they are to be found (or inserted) in(to) your `trac.ini` in the `[user_sync]` section as shown below:
    72 {{{
     77For testing purposes, default settings should be fine. However, there are some settings you can use for "fine-tuning" - they are to be found (or inserted) in(to) your `trac.ini` in the `[user_sync]` section:
     78{{{#!ini
    7379[user_sync]
    7480dryrun = true
     
    7985exclude_envs =
    8086}}}
     87
    8188The easiest way to modify these settings is using the IniAdminPlugin, where you always have some helpful information displayed next to the options. I will explain them here in short, though:
    8289
    83 === dryrun ===
     90=== dryrun
     91
    8492This enables the "test mode", in which no changes won't be done to your environments - especially the databases will not be written to. Instead, changes which would be written to the database will be stored in `*.sql` files, one for each environment. This is a boolean setting - so the only valid values here are "true" and "false".
    8593
    86 === merge_conflicts ===
     94=== merge_conflicts
     95
    8796What should be done if records from two (or more) environments conflict. Possible values are "skip" (do not update this user anywhere) and "newer" (use the record from the environment the user was last active in - which must not necessarily be the one with the most recent data). Default is "skip", to be on the safe side.
    8897
    8998What makes a conflict? Say user Tom registers in environment A, and sets his name to "Tom Sawyer" and his email to "tom@sawyer.tld". His password is stored to the shared `.htpasswd` file, so he can immediately login to environment B without registering again. He does so - but edits his record here, using the name "Tommy". If the field `name` is contained in the `sync_fields` list (see below), this would cause a conflict since the two names don't match - which means, the email won't be synchronized either. The same applies the other way round: If a different email was specified in one environment, the entire record would be considered conflicting.
    9099
    91 === sql_file_path ===
     100=== sql_file_path
     101
    92102The path where the `*.sql` files shall be stored into. If not set, they will be written into the `log` sub directory of the environment the plugin was invoked from.
    93103
    94 === sync_fields ===
     104=== sync_fields
     105
    95106Which fields of the user records should be considered for synchronization. By default, this is set to `name,email` - the two basic fields. If you use the UserManagerPlugin, you may want to add some more fields. Note that for now a single conflict on any of the fields will exclude a user record from being merged (though this may change in the future) - so the more fields added, the higher are chances for conflicts.
    96107
    97108There are two more fields considered here, even if not mentioned (and you should never introduce them into that list): the information used by the email verification. This means, if you enabled email verification in the AccountManagerPlugin, we will try to take care for that as well. So if a user verified for one environment, we try to do this for the other environments as well.
    98109
    99 === users_keep ===
     110=== users_keep
     111
    100112This option only affects purging: here you can define users which shall always be excluded from purging. The plugin will take care for your permission groups (e.g. anonymous,authenticated) automatically, so you don't need to add those (if your check - see [#Results below] - shows the plugin missed one, you might add it here, though).
    101113
    102 === exclude_envs ===
     114=== exclude_envs
     115
    103116A comma separated list of environments to exclude from our actions by default. The only effect here is that the corresponding check boxes in the web_ui will ''not'' be checked then.
    104117
    105 == Usage ==
    106 === Settings ===
     118== Usage
     119
     120=== Settings
     121
    107122You will find the interface on the Admin page in the Accounts section as ''User Sync'' (see also [#Example below screenshot]). After invoking this page, you can select the environments to synchronize. The list includes all Trac environments sharing the `TRAC_PARENT_DIR` with the environment you are currently in - though it did not yet check what password store they are using or even whether they share the same password file (this may be added later). If your selection includes an environment with conflicting data, it will be excluded later. All found environments are pre-selected except those mentioned in the `exclude_envs` setting - so you might want to (un)check one/some or leave it as is.
    108123
     
    111126The third section lets you select the actions to perform. ''Synchronize'' is already pre-selected here, since this is the main task this plugin is for, and also is what you probably want to do. This action means: Make sure all included environments get the account data users have entered in one of the environments for fields contained in the `sync_fields` setting. The second check box, labeled ''Purge'', will cause the plugin to remove all users from all environments - except those contained in the password file or mentioned in the `users_keep` setting. Of course, it would not touch your permission groups (anonymous,authenticated, and whatever you may have added) - these are evaluated automatically.
    112127
    113 {{{
    114 #!html
     128{{{#!html
    115129<DIV STYLE='background: #fdc; border: 2px solid #d00; color: #500; padding: .5em; margin: 1em 0;'>
    116130<B STYLE='color:#f00;'>WARNING:</B> You should always run in <code>dryrun</code> mode first and check the resulting <code>*.sql</code> files carefully. Every Trac setup has its specifics, and I only tested the script in my own setup. So as long as there's no feedback from other users, I'd consider it not-yet-safe!
     
    118132}}}
    119133
    120 === Results ===
     134=== Results
     135
    121136Now that you've made your selections, push the ''Perform actions'' button. When the page is reloaded, it will inform you about the results:
    122137
     
    130145 * Check the `UPDATE` statements in the same way, if there are any - in this case, the corresponding `SELECT` '''must''' return a record, but not necessarily with the same data (hence the update)
    131146
    132 === Hot run ===
    133 You may disable the `dryrun` mode once you finished the checks above. Well, you may even disable it immediately - but that's currently not recommended :-) Once you are sure everything works fine, you can even disable the writing of the `*.sql` files by setting the `sql_file_path = none` in your `trac.ini`.
     147=== Hot run
    134148
    135 == Example ==
     149You may disable the `dryrun` mode once you finished the checks above. Well, you may even disable it immediately - but that's currently not recommended. Once you are sure everything works fine, you can even disable the writing of the `*.sql` files by setting the `sql_file_path = none` in your `trac.ini`.
     150
     151== Example
     152
    136153This is what it could look like after a successful synchronization:
    137154
    138155[[Image(tus.jpg)]]
    139156
    140 == Future ==
     157== Future
     158
    141159There are some things I consider for the future:
    142160 1. only list "compatible" environments (i.e. those sharing the same password file, and where the current user has the required privileges)
     
    145163 1. introduce some "Listeners" (to notice registrations/changes in environments and automatically propagate them to the other environments, so you only need to run the synchronization manually once - which is after installation).
    146164
    147 I have to say here: This is not a promise. I wrote all this in my free time, and I will only continue it if my time permits me to. And believe me, I have some more projects and things I like to do, so don't get mad at me if I delay (or even stop). But hey, in those cases you've got the source, right?
     165== User Comments
    148166
    149 == User Comments ==
    150  * Your feedback here, please :-)
     167 * Your feedback here, please.
    151168
    152169[[Poll(Let others know what you think about the TracUserSyncPlugin:;I use it and I like it!;I use it and find it acceptable.;I tried it and didn't like it;I think it's great stuff and will give it a try!;It might be good - but I'd rather wait until it's declared stable.;I don't know what to think about it.)]]
    153170
    154 == Recent Changes ==
     171== Recent Changes
    155172
    156 [[ChangeLog(tracusersyncplugin, 4)]]
     173[[ChangeLog(tracusersyncplugin, 3)]]
    157174
    158 == Author/Contributors ==
     175== Author/Contributors
    159176
    160177'''Author:''' [wiki:izzy] [[BR]]
     178'''Maintainer:''' [[Maintainer]] [[BR]]
    161179'''Contributors:'''