From: kedder Date: Thu, 13 Mar 2003 09:27:24 +0000 (+0000) Subject: role names made case insensitive X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d716805c5f8c2f3737d0ce989bae671083230b49;p=roundup.git role names made case insensitive git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1587 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index a5d04c9..9c87f33 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -43,6 +43,7 @@ Feature: - relaxed CVS importing (sf feature 693277) - added support for searching on ranges of dates (see doc/user_guide.txt in chapter "Searching Page" for details) +- role names made case insensitive Fixed: diff --git a/roundup/security.py b/roundup/security.py index 0526b4e..3c87c48 100644 --- a/roundup/security.py +++ b/roundup/security.py @@ -27,7 +27,7 @@ class Role: - permissions ''' def __init__(self, name='', description='', permissions=None): - self.name = name + self.name = name.lower() self.description = description if permissions is None: permissions = [] @@ -98,7 +98,7 @@ class Security: roles = self.db.user.get(userid, 'roles') if roles is None: return 0 - for rolename in roles.split(','): + for rolename in [x.lower() for x in roles.split(',')]: if not rolename or not self.role.has_key(rolename): continue # for each of the user's Roles, check the permissions @@ -155,7 +155,7 @@ class Security: 'rolename' is the name of the role to add the permission to. ''' - role = self.role[rolename] + role = self.role[rolename.lower()] role.permissions.append(permission) # vim: set filetype=python ts=4 sw=4 et si diff --git a/test/test_mailgw.py b/test/test_mailgw.py index d18c8b4..cfcd82f 100644 --- a/test/test_mailgw.py +++ b/test/test_mailgw.py @@ -8,7 +8,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: test_mailgw.py,v 1.40 2003-02-28 03:33:25 richard Exp $ +# $Id: test_mailgw.py,v 1.41 2003-03-13 09:27:24 kedder Exp $ import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib @@ -644,7 +644,7 @@ Subject: [issue1] Testing... [nosy=-richard] def testNewUserAuthor(self): # first without the permission # heh... just ignore the API for a second ;) - self.db.security.role['Anonymous'].permissions=[] + self.db.security.role['anonymous'].permissions=[] anonid = self.db.user.lookup('anonymous') self.db.user.set(anonid, roles='Anonymous') @@ -670,7 +670,7 @@ This is a test submission of a new issue. # now with the permission p = self.db.security.getPermission('Email Registration') - self.db.security.role['Anonymous'].permissions=[p] + self.db.security.role['anonymous'].permissions=[p] handler = self.instance.MailGW(self.instance, self.db) handler.trapExceptions = 0 message = cStringIO.StringIO(s)