From: richard Date: Mon, 2 Sep 2002 08:11:02 +0000 (+0000) Subject: more upgrading docco and a tool to fix roles X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=36fa27fc046b7e458b9a5f81ed51d60d2d1f373e;p=roundup.git more upgrading docco and a tool to fix roles git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1026 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/doc/upgrading.txt b/doc/upgrading.txt index 21074a2..c14a40c 100644 --- a/doc/upgrading.txt +++ b/doc/upgrading.txt @@ -162,6 +162,7 @@ to:: noting that your definition of the nosy Multilink will override the normal one. + 0.5.0 User schema changes ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -298,6 +299,30 @@ You may verify the setup of Permissions and Roles using the new "``roundup-admin security``" command. +0.5.0 User changes +~~~~~~~~~~~~~~~~~~ + +To support all those schema changes, you'll need to massage your user database +a little too, to: + +1. make sure there's an "anonymous" user - this user is mandatory now and is + the one that unknown users are logged in as. +2. make sure all users have at least one Role. + +If you don't have the "anonymous" user, create it now with the command:: + + roundup-admin create user username=anonymous roles=Anonymous + +making sure the capitalisation is the same as above. Once you've done that, +you'll need to set the roles property on all users to a reasonable default. +The admin user should get "Admin", the anonymous user "Anonymous" +and all other users "User". The ``fixroles.py`` script in the tools directory +will do this. Run it like so (where python is your python 2+ binary):: + + python tools/fixroles.py -i + + + 0.5.0 CGI interface changes --------------------------- diff --git a/tools/fixroles.py b/tools/fixroles.py new file mode 100644 index 0000000..9744b87 --- /dev/null +++ b/tools/fixroles.py @@ -0,0 +1,40 @@ +import sys + +from roundup import admin + +class AdminTool(admin.AdminTool): + def __init__(self): + self.commands = admin.CommandDict() + for k in AdminTool.__dict__.keys(): + if k[:3] == 'do_': + self.commands[k[3:]] = getattr(self, k) + self.help = {} + for k in AdminTool.__dict__.keys(): + if k[:5] == 'help_': + self.help[k[5:]] = getattr(self, k) + self.instance_home = '' + self.db = None + + def do_fixroles(self, args): + '''Usage: fixroles + Set the roles property for all users to reasonable defaults. + + The admin user gets "Admin", the anonymous user gets "Anonymous" + and all other users get "User". + ''' + # get the user class + cl = self.get_class('user') + for userid in cl.list(): + username = cl.get(userid, 'username') + if username == 'admin': + roles = 'Admin' + elif username == 'anonymous': + roles = 'Anonymous' + else: + roles = 'User' + cl.set(userid, roles=roles) + return 0 + +if __name__ == '__main__': + tool = AdminTool() + sys.exit(tool.main())