Changes between Version 4 and Version 5 of FlexibleAssignToPlugin


Ignore:
Timestamp:
Oct 17, 2007, 3:13:44 PM (16 years ago)
Author:
Morris
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FlexibleAssignToPlugin

    v4 v5  
    3939
    4040=== Prerequisites ===
    41  * Trac 0.11+ (built and tested against 0.11dev trunk r6047)
    42  * Python 2.5+ (I can't confirm that Python 2.5 is actually required -- but it's the version I developed under and the only one I've tested with.  If you successfully use this plugin with another version of Python, please update this wiki with your notes. - Morris)
     41 * Trac 0.11+ (built and tested against [http://trac.edgewall.org/browser/trunk?rev=6047 0.11dev trunk r6047])
     42 * Python 2.5+ (''I can't confirm that Python 2.5 is actually required -- but it's the version I developed under and the only one I've tested with.  If you successfully use this plugin with another version of Python, please update this wiki with your notes. - Morris'')
    4343
    4444=== How do I use it? ===
     
    5252          This module must contain a class that:
    5353            * declares that it implements IValidOwnerProvider
    54             * provides a getUsers method that takes a 'next_action_obj' as it's sole param and returns a list of instances of !SimpleUser (or a subclass) representing valid owners of that next state.  Keep reading for details on the getUsers() method and the SimpleUser class.  If this sounds confusing and/or you just want to jump in and get your hands dirty, go check out the source for !SampleValidOwnerProvider.py. 
     54            * provides a getUsers method that takes a 'next_action_obj' as it's sole param and returns a list of instances of !SimpleUser (or a subclass) representing valid owners of that next state.  Keep reading for details on the getUsers() method and the !SimpleUser class.  If this sounds confusing and/or you just want to jump in and get your hands dirty, go check out the source for !SampleValidOwnerProvider.py. 
    5555         c. the getUsers() method [[BR]]
    56           The sole param to getUsers(), next_action_obj, represents a workflow state that is available from the current ticket state AND that implements the "set_owner" operation (if you really want to get into the nitty gritty, next_action_obj is identical to the objects in the ConfigurableTicketWorkflow.actions list in trac/ticket/default_workflow.py).  next_action_obj is provided to getUsers for the sole purpose of providing a way to look up custom workflow state params.  For example, if you had a workflow state defined in your trac.ini like this:
     56          The sole param to getUsers(), next_action_obj, represents a workflow state that is available from the current ticket state AND that implements the "set_owner" operation (if you really want to get into the nitty gritty, next_action_obj is identical to the objects in the !ConfigurableTicketWorkflow.actions list in trac/ticket/default_workflow.py).  next_action_obj is provided to getUsers for the sole purpose of providing a way to look up custom workflow state params.  For example, if you had a workflow state defined in your trac.ini like this:
    5757{{{
    5858mystate = oldstate -> mystate
     
    6868allowed_groups = getlist(next_action_obj, 'valid_user_groups')
    6969}}}
    70           You could then use the 'allowed_groups' list to query a database (or do whatever else you need to do) to get back a list of user information -- in this case, (presumably) return the users who are members of either the "Admins" or "Development Managers" group.  Each user's info should be packed into an instance of !SimpleUser (or a subclass).  The final return from getUsers() should be a *unique* list of !SimpleUser instances (no checks for uniqueness are guaranteed to be performed on the list of returned users).  Again, see SampleValidOwnerProvider.py for a hopefully straightforward example.  Note that individual workflow states can be disabled; see item 4, "Enable/disable individual workflow states", below.
    71          d. the SimpleUser class [[BR]]
     70          You could then use the 'allowed_groups' list to query a database (or do whatever else you need to do) to get back a list of user information -- in this case, (presumably) return the users who are members of either the "Admins" or "Development Managers" group.  Each user's info should be packed into an instance of !SimpleUser (or a subclass).  The final return from getUsers() should be a *unique* list of !SimpleUser instances (no checks for uniqueness are guaranteed to be performed on the list of returned users).  Again, see !SampleValidOwnerProvider.py for a hopefully straightforward example.  Note that individual workflow states can be disabled; see item 4, "Enable/disable individual workflow states", below.
     71         d. the !SimpleUser class [[BR]]
    7272          There are three fields in !SimpleUser that you *must* set.  Not having these set (e.g., left as their default, None) will lead to assert exceptions from !FlexibleAssignTo:
    7373{{{
     
    7777}}}
    7878          There are standard get/set methods for these; see the !SimpleUser class for specific method prototypes.  '''NOTE:''' the format of username values *must* match the format of usernames for logged-in users -- if John Doe logs in with the username "jdoe", then a !SimpleUser instance representing John Doe should get its username attribute set to "jdoe".  If you don't do this, !FlexibleAssignTo will not work correctly.
     79
     80'''3. Config options''' [[BR]]
     81     (All of the following options should be specified in the {{{[subscribetoticket]}}} section of your trac.ini)
     82     * ensure_user_data [[BR]]
     83       Defaults to false. [[BR]]
     84       !FlexibleAssignTo also provides functionality to ensure that key user data (username, fullname, email) is added to the trac session_attribute table as said user data is retrieved for "assign to" use, so that ticket assign/modification emails will be sent to the assigned user's email address.  '''NOTE:''' this feature will not overwrite session_attribute data already present.
     85
     86     * use_custom_get_known_users [[BR]]
     87       Defaults to false.  [[BR]]
     88       Overrides the default get_known_users capability provided by default Trac (trac.env) method of the same name: whereas the Trac default get_known_users returns info only for those users who have logged in, this method returns info for every user who has data in the session_attribute table and is flagged authenticated (e.g., session_attribute.authenticated = 1).  This functionality was designed to work in concert with the "ensure_user_data" feature, which autopopulates user email & name in the session_attribute table.  Generates one tuple for every user, of the form (username, name, email), ordered alphanumerically by username.  [[BR]]
     89       '''NOTE:''' Changes to this setting ''require'' a server restart to take effect!  [[BR]]
     90       '''NOTE:''' It is recommended that you also enable the ensure_user_data option if you use this method -- otherwise the behavior will be superficially no different than the default Trac get_known_users functionality.
     91
     92'''4. Enable/disable individual workflow states''' [[BR]]
     93    Finally, note that by default !FlexibleAssignTo operates on EVERY state in your workflow, replacing the "assign to" field for every state with a "set_owner" operation.  To disable !FlexibleAssignTo for particular states (without having to disable the entire plugin), add the following key to your workflow state:
     94{{{
     95mystate.use_flexibleassignto = false
     96}}}
    7997
    8098