Re: How to make the username "case insensitive"

Ralf Schlatterbeck <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
On Sat, Mar 29, 2014 at 04:44:59PM +0800, YanQian wrote:
> Hi,
> I  am using roundup 1.4.20 with LDAPLogin2 on RHEL 6.2.
> 
> # roundup-admin -v
> 1.4.20 (python 2.6.6)
> 
> # cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 6.2 (Santiago)
>  
> I can login with ldap account successfully, but everyone need to
> remember the username which he logined at the first time, or he will
> failed to login because case sensitive issues.
> 
> for example, if my username is "Simba", and I typed "Simba" (first
> letter is upper case) to login roundup at the first time, then I have
> to input the username exactly same as the first time, even if I use
> "simba"(lower case), it will not allow me in.
>  
> Since most of users are working with Windows AD domain, and when they
> login into other systems, usernames are all case insensitive. 
>  
> So, can we have a option in the config.ini that we can change the
> username to "case insensitive" ?

You can add an auditor to roundup (in the detectors directory of your
tracker instance) that converts all usernames to lowercase,
e.g.(untested):

def username_lowercase(db, cl, nodeid, new_values):
    if 'username' in new_values:
        new_values['username'] = new_values['username'].lower()
def init(db):
    db.user.audit("set", username_lowercase)
    db.user.audit("create", username_lowercase)

The second part is to change your ldap authentication modification for
roundup to always convert the username to lowercase. I guess you made a
modification to your roundup instance for ldap login or does RedHat come
with such a modification?

Of course after this modification you should change all existing
usernames to lowercase, e.g., by script(again untested):

from roundup import instance
tracker = instance.open('.')
db = tracker.open ('admin')

for id in db.user.getnodeids(retired=False):
    db.user.set(id, username=db.user.get(id, 'username').lower())


So I guess we won't need any modifications to roundup core for this
usage scenario.

Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   http://www.runtux.com
Reichergasse 131, A-3411 Weidling       email: [email protected]
allmenda.com member                     email: [email protected]

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.