Code

21074a2fec6483f7a46e33d813d5d1013520b494
[roundup.git] / doc / upgrading.txt
1 ======================================
2 Upgrading to newer versions of Roundup
3 ======================================
5 Please read each section carefully and edit your instance home files
6 accordingly.
8 .. contents::
10 Migrating from 0.4.x to 0.5.0
11 =============================
13 This has been a fairly major revision of Roundup:
15 1. Brand new, much more powerful, flexible, tasty and nutritious templating.
16    Unfortunately, this means all your current templates are useless. Please
17    don't hesitate to ask on roundup-users for help (or complete conversions
18    if you're completely stuck)!
19 2. The database backed got a lot more flexible, allowing Metakit and SQL
20    databases! The only SQL database implemented at present is gadfly, but
21    others shouldn't be a whole lot more work.
22 3. A brand new, highly flexible and much more robust security system including
23    a system of Permissions, Roles and Role assignments to users. You may now
24    define your own Permissions that may be checked in CGI transactions.
25 4. Journalling has been made less storage-hungry, so has been turned on
26    by default *except* for author, recipient and nosy link/unlink events. You
27    are advised to turn it off in your instances too.
28 5. Because of the above changes, the instance configuration has seen some
29    major changes. See below for the details.
31 Please, *back up your database* before you start the migration process. This
32 is as simple as copying the "db" directory and all its contents from your
33 instance to somewhere safe.
36 0.5.0 Configuration
37 -------------------
39 Due to the new templating having a top-level ``page`` that defines links for
40 searching, indexes, adding items etc, the following variables are no longer
41 used:
43 - HEADER_INDEX_LINKS
44 - HEADER_ADD_LINKS
45 - HEADER_SEARCH_LINKS
46 - SEARCH_FILTERS
47 - DEFAULT_INDEX
48 - UNASSIGNED_INDEX
49 - USER_INDEX
50 - ISSUE_FILTER
52 The new security implementation will require additions to the dbinit module,
53 but also removes the need for the following instance config variables:
55 - ANONYMOUS_ACCESS
56 - ANONYMOUS_REGISTER
58 but requires two new variables which define the Roles assigned to users who
59 register through the web and e-mail interfaces:
61 - NEW_WEB_USER_ROLES
62 - NEW_EMAIL_USER_ROLES
64 in both cases, 'User' is a good initial setting. To emulate
65 ``ANONYMOUS_ACCESS='deny'``, remove all "View" Permissions from the
66 "Anonymous" Role. To emulate ``ANONYMOUS_REGISTER='deny'``, remove the "Web
67 Registration" and/or the "Email Registration" Permission from the "Anonymous"
68 Role. See the section on customising security in the `customisation
69 documentation`_ for more information.
72 0.5.0 Schema Specification
73 --------------------------
75 0.5.0 Database backend changes
76 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78 Your select_db module in your instance has changed a fair bit. Where it used
79 to contain::
81  # WARNING: DO NOT EDIT THIS FILE!!!
82  from roundup.backends.back_anydbm import Database
84 it must now contain::
86  # WARNING: DO NOT EDIT THIS FILE!!!
87  from roundup.backends.back_anydbm import Database, Class, FileClass, IssueClass
89 Note the addition of the Class, FileClass, IssueClass imports. These are very
90 important, as they're going to make the next change work too. You now need to
91 modify the top of the dbinit module in your instance from::
93  import instance_config
94  from roundup import roundupdb
95  from select_db import Database
97  from roundup.roundupdb import Class, FileClass
99  class Database(roundupdb.Database, select_db.Database):
100      ''' Creates a hybrid database from:
101           . the selected database back-end from select_db
102           . the roundup extensions from roundupdb
103      '''
104      pass
106  class IssueClass(roundupdb.IssueClass):
107      ''' issues need the email information
108      '''
109      pass
113 to just::
115  import instance_config
116  from select_db import Database, Class, FileClass, IssueClass
118 Yes, remove the Database and IssueClass definitions and those other imports.
119 They're not needed any more!
122 0.5.0 Journalling changes
123 ~~~~~~~~~~~~~~~~~~~~~~~~~
125 Journalling has been optimised for storage. Journalling of links has been
126 turned back on by default. If your tracker has a large user base, you may wish
127 to turn off journalling of nosy list, message author and message recipient
128 link and unlink events. You do this by adding ``do_journal='no'`` to the Class
129 initialisation in your dbinit. For example, your *msg* class initialisation
130 probably looks like this::
132     msg = FileClass(db, "msg",
133                     author=Link("user"), recipients=Multilink("user"),
134                     date=Date(),         summary=String(),
135                     files=Multilink("file"),
136                     messageid=String(),  inreplyto=String())
138 to turn off journalling of author and recipient link events, add
139 ``do_journal='no'`` to the ``author=Link("user")`` part of the statement,
140 like so::
142     msg = FileClass(db, "msg",
143                     author=Link("user", do_journal='no'),
144                     recipients=Multilink("user", do_journal='no'),
145                     date=Date(),         summary=String(),
146                     files=Multilink("file"),
147                     messageid=String(),  inreplyto=String())
149 Nosy list link event journalling is actually turned off by default now. If you
150 want to turn it onn, change to your issue class' nosy list, change its
151 definition from::
153     issue = IssueClass(db, "issue",
154                     assignedto=Link("user"), topic=Multilink("keyword"),
155                     priority=Link("priority"), status=Link("status"))
157 to::
159     issue = IssueClass(db, "issue", nosy=Multilink("user", do_journal='yes'),
160                     assignedto=Link("user"), topic=Multilink("keyword"),
161                     priority=Link("priority"), status=Link("status"))
163 noting that your definition of the nosy Multilink will override the normal one.
165 0.5.0 User schema changes
166 ~~~~~~~~~~~~~~~~~~~~~~~~~
168 Users have two more properties, "queries" and "roles". You'll have something
169 like this in your dbinit module now::
171     user = Class(db, "user",
172                     username=String(),   password=Password(),
173                     address=String(),    realname=String(),
174                     phone=String(),      organisation=String(),
175                     alternate_addresses=String())
176     user.setkey("username")
178 and you'll need to add the new properties and the new "query" class to it
179 like so::
181     query = Class(db, "query",
182                     klass=String(),     name=String(),
183                     url=String())
184     query.setkey("name")
186     # Note: roles is a comma-separated string of Role names
187     user = Class(db, "user",
188                     username=String(),   password=Password(),
189                     address=String(),    realname=String(),
190                     phone=String(),      organisation=String(),
191                     alternate_addresses=String(),
192                     queries=Multilink('query'), roles=String())
193     user.setkey("username")
195 The "queries" property is used to store off the user's favourite database
196 queries. The "roles" property is explained below in `0.5.0 Security
197 Settings`_.
200 0.5.0 Security Settings
201 ~~~~~~~~~~~~~~~~~~~~~~~
203 See the `security documentation`_ for an explanation of how the new security
204 system works. In a nutshell though, the security is handled as a four step
205 process:
207 1. Permissions are defined as having a name and optionally a hyperdb class
208    they're specific to,
209 2. Roles are defined that have one or more Permissions,
210 3. Users are assigned Roles in their "roles" property, and finally
211 4. Roundup checks that users have appropriate Permissions at appropriate times
212    (like editing issues).
214 Your instance dbinit module's *open* function now has to define any
215 Permissions that are specific to your instance, and also the assignment
216 of Permissions to Roles. At the moment, your open function
217 ends with::
219     import detectors
220     detectors.init(db)
222     return db
224 and what we need to do is insert some commands that will set up the security
225 parameters. Right above the ``import detectors`` line, you'll want to insert
226 these lines::
228     #
229     # SECURITY SETTINGS
230     #
231     # new permissions for this schema
232     for cl in 'issue', 'file', 'msg', 'user':
233         db.security.addPermission(name="Edit", klass=cl,
234             description="User is allowed to edit "+cl)
235         db.security.addPermission(name="View", klass=cl,
236             description="User is allowed to access "+cl)
238     # Assign the access and edit permissions for issue, file and message
239     # to regular users now
240     for cl in 'issue', 'file', 'msg':
241         p = db.security.getPermission('View', cl)
242         db.security.addPermissionToRole('User', p)
243         p = db.security.getPermission('Edit', cl)
244         db.security.addPermissionToRole('User', p)
245     # and give the regular users access to the web and email interface
246     p = db.security.getPermission('Web Access')
247     db.security.addPermissionToRole('User', p)
248     p = db.security.getPermission('Email Access')
249     db.security.addPermissionToRole('User', p)
251     # May users view other user information? Comment these lines out
252     # if you don't want them to
253     p = db.security.getPermission('View', 'user')
254     db.security.addPermissionToRole('User', p)
256     # Assign the appropriate permissions to the anonymous user's Anonymous
257     # Role. Choices here are:
258     # - Allow anonymous users to register through the web
259     p = db.security.getPermission('Web Registration')
260     db.security.addPermissionToRole('Anonymous', p)
261     # - Allow anonymous (new) users to register through the email gateway
262     p = db.security.getPermission('Email Registration')
263     db.security.addPermissionToRole('Anonymous', p)
264     # - Allow anonymous users access to the "issue" class of data
265     #   Note: this also grants access to related information like files,
266     #         messages, statuses etc that are linked to issues
267     #p = db.security.getPermission('View', 'issue')
268     #db.security.addPermissionToRole('Anonymous', p)
269     # - Allow anonymous users access to edit the "issue" class of data
270     #   Note: this also grants access to create related information like
271     #         files and messages etc that are linked to issues
272     #p = db.security.getPermission('Edit', 'issue')
273     #db.security.addPermissionToRole('Anonymous', p)
275     # oh, g'wan, let anonymous access the web interface too
276     p = db.security.getPermission('Web Access')
277     db.security.addPermissionToRole('Anonymous', p)
279 Note in the comments there the places where you might change the permissions
280 to restrict users or grant users more access. If you've created additional
281 classes that users should be able to edit and view, then you should add them
282 to the "new permissions for this schema" section at the start of the security
283 block. Then add them to the "Assign the access and edit permissions" section
284 too, so people actually have the new Permission you've created.
286 One final change is needed that finishes off the security system's
287 initialisation. We need to add a call to ``db.post_init()`` at the end of the
288 dbinit open() function. Add it like this::
290     import detectors
291     detectors.init(db)
293     # schema is set up - run any post-initialisation
294     db.post_init()
295     return db
297 You may verify the setup of Permissions and Roles using the new
298 "``roundup-admin security``" command.
301 0.5.0 CGI interface changes
302 ---------------------------
304 The CGI interface code was completely reorganised and largely rewritten. The
305 end result is that this section of your instance interfaces module will need
306 changing from::
308  from roundup import mailgw
309  from roundup.cgi import client
310  
311  class Client(client.Client): 
312      ''' derives basic CGI implementation from the standard module,
313          with any specific extensions
314      '''
315      pass
317 to::
319  from roundup import cgi_client, mailgw
320  from roundup.i18n import _
321  
322  class Client(cgi_client.Client):
323      ''' derives basic CGI implementation from the standard module,
324          with any specific extensions
325      '''
326      pass
328 0.5.0 HTML templating
329 ---------------------
331 You'll want to make a backup of your current instance html directory. You
332 should then copy the html directory from the Roundup source template that you
333 used to create your instance, and modify it according to your local schema
334 changes.
336 If you need help with the new templating system, please ask questions on the
337 roundup-users mailing list (available through the roundup project page on
338 sourceforge, http://roundup.sf.net/)
341 0.5.0 Detectors
342 ---------------
344 The nosy reactor has been updated to handle the instance not having an
345 "assignedto" property on issues. You may want to copy it into your instance's
346 detectors directory. Chances are you've already fixed it though :)
349 Migrating from 0.4.1 to 0.4.2
350 =============================
352 0.4.2 Configuration
353 -------------------
354 The USER_INDEX definition introduced in 0.4.1 was too restrictive in its
355 allowing replacement of 'assignedto' with the user's userid. Users must change
356 the None value of 'assignedto' to 'CURRENT USER' (the string, in quotes) for
357 the replacement behaviour to occur now.
359 The new configuration variables are:
361 - EMAIL_KEEP_QUOTED_TEXT 
362 - EMAIL_LEAVE_BODY_UNCHANGED
363 - ADD_RECIPIENTS_TO_NOSY
365 See the sample configuration files in::
367  <roundup source>/roundup/templates/classic/instance_config.py
369 and::
371  <roundup source>/roundup/templates/extended/instance_config.py
373 and the `customisation documentation`_ for information on how they're used.
376 0.4.2 Changes to detectors
377 --------------------------
378 You will need to copy the detectors from the distribution into your instance
379 home "detectors" directory. If you used the classic schema, the detectors
380 are in::
382  <roundup source>/roundup/templates/classic/detectors/
384 If you used the extended schema, the detectors are in::
386  <roundup source>/roundup/templates/extended/detectors/
388 The change means that schema-specific code has been removed from the
389 mail gateway and cgi interface and made into auditors:
391 - nosyreactor.py has now got an updatenosy auditor which updates the nosy
392   list with author, recipient and assignedto information.
393 - statusauditor.py makes the unread or resolved -> chatting changes and
394   presets the status of an issue to unread.
396 There's also a bug or two fixed in the nosyreactor code.
398 0.4.2 HTML templating changes
399 -----------------------------
400 The link() htmltemplate function now has a "showid" option for links and
401 multilinks. When true, it only displays the linked node id as the anchor
402 text. The link value is displayed as a tooltip using the title anchor
403 attribute. To use in eg. the superseder field, have something like this::
405    <td>
406     <display call="field('superseder', showid=1)">
407     <display call="classhelp('issue', 'id,title', label='list', width=500)">
408     <property name="superseder">
409      <br>View: <display call="link('superseder', showid=1)">
410     </property>
411    </td>
413 The stylesheets have been cleaned up too. You may want to use the newer
414 versions in::
416  <roundup source>/roundup/templates/<template>/html/default.css
420 Migrating from 0.4.0 to 0.4.1
421 =============================
423 0.4.1 Files storage
424 -------------------
426 Messages and files from newly created issues will be put into subdierectories
427 in thousands e.g. msg123 will be put into files/msg/0/msg123, file2003
428 will go into files/file/2/file2003. Previous messages are still found, but
429 could be put into this structure.
431 0.4.1 Configuration
432 -------------------
434 To allow more fine-grained access control, the variable used to check
435 permission to auto-register users in the mail gateway is now called
436 ANONYMOUS_REGISTER_MAIL rather than overloading ANONYMOUS_REGISTER. If the
437 variable doesn't exist, then ANONYMOUS_REGISTER is tested as before.
439 Configuring the links in the web header is now easier too. The following
440 variables have been added to the classic instance_config.py::
442   HEADER_INDEX_LINKS   - defines the "index" links to be made available
443   HEADER_ADD_LINKS     - defines the "add" links
444   DEFAULT_INDEX        - specifies the index view for DEFAULT
445   UNASSIGNED_INDEX     - specifies the index view for UNASSIGNED
446   USER_INDEX           - specifies the index view for USER
448 See the <roundup source>/roundup/templates/classic/instance_config.py for more
449 information - including how the variables are to be set up. Most users will
450 just be able to copy the variables from the source to their instance home. If
451 you've modified the header by changing the source of the interfaces.py file in
452 the instance home, you'll need to remove that customisation and move it into
453 the appropriate variables in instance_config.py.
455 The extended schema has similar variables added too - see the source for more
456 info.
458 0.4.1 Alternate E-Mail Addresses
459 --------------------------------
461 If you add the property "alternate_addresses" to your user class, your users
462 will be able to register alternate email addresses that they may use to
463 communicate with roundup as. All email from roundup will continue to be sent
464 to their primary address.
466 If you have not edited the dbinit.py file in your instance home directory,
467 you may simply copy the new dbinit.py file from the core code. If you used
468 the classic schema, the interfaces file is in::
470  <roundup source>/roundup/templates/classic/dbinit.py
472 If you used the extended schema, the file is in::
474  <roundup source>/roundup/templates/extended/dbinit.py 
476 If you have modified your dbinit.py file, you need to edit the dbinit.py
477 file in your instance home directory. Find the lines which define the user
478 class::
480     user = Class(db, "msg",
481                     username=String(),   password=Password(),
482                     address=String(),    realname=String(), 
483                     phone=String(),      organisation=String(),
484                     alternate_addresses=String())
486 You will also want to add the property to the user's details page. The
487 template for this is the "user.item" file in your instance home "html"
488 directory. Similar to above, you may copy the file from the roundup source if
489 you haven't modified it. Otherwise, add the following to the template::
491    <display call="multiline('alternate_addresses')">
493 with appropriate labelling etc. See the standard template for an idea.
497 Migrating from 0.3.x to 0.4.0
498 =============================
500 0.4.0 Message-ID and In-Reply-To addition
501 -----------------------------------------
502 0.4.0 adds the tracking of messages by message-id and allows threading
503 using in-reply-to. Most e-mail clients support threading using this
504 feature, and we hope to add support for it to the web gateway. If you
505 have not edited the dbinit.py file in your instance home directory, you may
506 simply copy the new dbinit.py file from the core code. If you used the
507 classic schema, the interfaces file is in::
509  <roundup source>/roundup/templates/classic/dbinit.py
511 If you used the extended schema, the file is in::
513  <roundup source>/roundup/templates/extended/dbinit.py 
515 If you have modified your dbinit.py file, you need to edit the dbinit.py
516 file in your instance home directory. Find the lines which define the msg
517 class::
519     msg = FileClass(db, "msg",
520                     author=Link("user"), recipients=Multilink("user"),
521                     date=Date(),         summary=String(),
522                     files=Multilink("file"))
524 and add the messageid and inreplyto properties like so::
526     msg = FileClass(db, "msg",
527                     author=Link("user"), recipients=Multilink("user"),
528                     date=Date(),         summary=String(),
529                     files=Multilink("file"),
530                     messageid=String(),  inreplyto=String())
532 Also, configuration is being cleaned up. This means that your dbinit.py will
533 also need to be changed in the open function. If you haven't changed your
534 dbinit.py, the above copy will be enough. If you have, you'll need to change
535 the line (round line 50)::
537     db = Database(instance_config.DATABASE, name)
539 to::
541     db = Database(instance_config, name)
544 0.4.0 Configuration
545 --------------------
546 ``INSTANCE_NAME`` and ``EMAIL_SIGNATURE_POSITION`` have been added to the
547 instance_config.py. The simplest solution is to copy the default values
548 from template in the core source.
550 The mail gateway now checks ``ANONYMOUS_REGISTER`` to see if unknown users
551 are to be automatically registered with the tracker. If it is set to "deny"
552 then unknown users will not have access. If it is set to "allow" they will be
553 automatically registered with the tracker.
556 0.4.0 CGI script roundup.cgi
557 ----------------------------
558 The CGI script has been updated with some features and a bugfix, so you should
559 copy it from the roundup cgi-bin source directory again. Make sure you update
560 the ROUNDUP_INSTANCE_HOMES after the copy.
563 0.4.0 Nosy reactor
564 ------------------
565 The nosy reactor has also changed - copy the nosyreactor.py file from the core
566 source::
568    <roundup source>/roundup/templates/<template>/detectors/nosyreactor.py
570 to your instance home "detectors" directory.
573 0.4.0 HTML templating
574 ---------------------
575 The field() function was incorrectly implemented - links and multilinks now
576 display as text fields when rendered using field(). To display a menu (drop-
577 down or select box) you need to use the menu() function.
581 Migrating from 0.2.x to 0.3.x
582 =============================
584 0.3.x Cookie Authentication changes
585 -----------------------------------
586 0.3.0 introduces cookie authentication - you will need to copy the
587 interfaces.py file from the roundup source to your instance home to enable
588 authentication. If you used the classic schema, the interfaces file is in::
590  <roundup source>/roundup/templates/classic/interfaces.py
592 If you used the extended schema, the file is in::
594  <roundup source>/roundup/templates/extended/interfaces.py
596 If you have modified your interfaces.Client class, you will need to take
597 note of the login/logout functionality provided in roundup.cgi_client.Client
598 (classic schema) or roundup.cgi_client.ExtendedClient (extended schema) and
599 modify your instance code apropriately.
602 0.3.x Password encoding
603 -----------------------
604 This release also introduces encoding of passwords in the database. If you
605 have not edited the dbinit.py file in your instance home directory, you may
606 simply copy the new dbinit.py file from the core code. If you used the
607 classic schema, the interfaces file is in::
609  <roundup source>/roundup/templates/classic/dbinit.py
611 If you used the extended schema, the file is in::
613  <roundup source>/roundup/templates/extended/dbinit.py
616 If you have modified your dbinit.py file, you may use encoded passwords:
618 1. Edit the dbinit.py file in your instance home directory
619    a. At the first code line of the open() function::
621        from roundup.hyperdb import String, Date, Link, Multilink
623       alter to include Password, as so::
625        from roundup.hyperdb import String, Password, Date, Link, Multilink
627    b. Where the password property is defined (around line 66)::
629        user = Class(db, "user", 
630                        username=String(),   password=String(),
631                        address=String(),    realname=String(), 
632                        phone=String(),      organisation=String())
633        user.setkey("username")
635       alter the "password=String()" to "password=Password()"::
637        user = Class(db, "user", 
638                        username=String(),   password=Password(),
639                        address=String(),    realname=String(), 
640                        phone=String(),      organisation=String())
641        user.setkey("username")
643 2. Any existing passwords in the database will remain cleartext until they
644    are edited. It is recommended that at a minimum the admin password be
645    changed immediately::
647       roundup-admin -i <instance home> set user1 password=<new password>
650 0.3.x Configuration
651 -------------------
652 FILTER_POSITION, ANONYMOUS_ACCESS, ANONYMOUS_REGISTER have been added to
653 the instance_config.py. Simplest solution is to copy the default values from
654 template in the core source.
656 MESSAGES_TO_AUTHOR has been added to the IssueClass in dbinit.py. Set to 'yes'
657 to send nosy messages to the author. Default behaviour is to not send nosy
658 messages to the author. You will need to add MESSAGES_TO_AUTHOR to your
659 dbinit.py in your instance home.
662 0.3.x CGI script roundup.cgi
663 ----------------------------
664 There have been some structural changes to the roundup.cgi script - you will
665 need to install it again from the cgi-bin directory of the source
666 distribution. Make sure you update the ROUNDUP_INSTANCE_HOMES after the
667 copy.
670 .. _`customisation documentation`: customizing.html
671 .. _`security documentation`: security.html