Opened 5 years ago

Closed 5 years ago

# SetRule and username case sensitivity

Reported by: Owned by: christiano@… Ryan J Ollos normal DynamicFieldsPlugin normal owner set_to restrict_owner 1.0

### Description

We don't have any rules on user names on our local trac installation. As such, our system has names with both upper and lower case letters. I was having trouble using the SetRule to change the owner of the ticket based on the type field. I have restrict_owner = true in my trac.ini so that the system allows the users to select the owner from a drop down list. This seems to preserve the capitalization of the username so the SetRule fails, if the user has any capital letters in their username. I have included a little work around.

--- rules.js    (revision 15591)
+++ rules.js    (working copy)

@@ -358,7 +360,8 @@
var option = jQuery(e).text();
if (set_to == '!' && option.length) // special non-empty rule
set_to = option;
-      if (option == set_to) {
+      if (option.toLowerCase() == set_to) {
+        set_to = option
doit = true;
}
});



### comment:1 follow-ups:  2  5 Changed 5 years ago by Ryan J Ollos

Could you post an example of your rule so that I can test? Is your Trac instance running on Windows or Linux?

I guess the issue is that the owner names specified in the rules of trac.ini cannot be case sensitive, or at least, even if specifying case-sensitive names was effective on Linux it would not be effective on Windows.

Have you tried setting [trac] ignore_auth_case = enabled?

Last edited 5 years ago by Ryan J Ollos (previous) (diff)

### comment:2 in reply to:  1 ; follow-up:  7 Changed 5 years ago by christiano@…

Could you post an example of your rule so that I can test? Is your Trac instance running on Windows or Linux?

owner.set_to_BBLeroyBrown_when_type = custom_type (overwrite)

We are using Linux to run Trac.

I guess the issue is that the owner names specified in the rules of trac.ini cannot be case sensitive, or at least, even if specifying case-sensitive names was effective on Linux it would not be effective on Windows.

Have you tried setting [trac] ignore_auth_case = enabled?

I didn't know about ignore_auth_case. Thank you for the info. It was disabled. Setting ignore_auth_case = true didn't fix the issue with existing accounts as they are already stored in a case preserving manner. It does, however, change all newly created user accounts to be lowercase. Going forward this would fix my problem.

I will either have to roll with my little hack or go through and sanitize all the existing user accounts. This is just a "non time consuming" side project for at work so if there is a quick and easy way of fixing existing user names, I would appreciate pointers/guidance/link.

christian

### comment:3 Changed 5 years ago by Ryan J Ollos

Thanks, I will do some testing.

### comment:4 Changed 5 years ago by Ryan J Ollos

Status: new → accepted

### comment:5 in reply to:  1 Changed 5 years ago by anonymous

I guess the issue is that the owner names specified in the rules of trac.ini cannot be case sensitive, or at least, even if specifying case-sensitive names was effective on Linux it would not be effective on Windows.

I had to refresh my memory on this. Trac uses ConfigParser with default implementation of optionxfrom, which converts all options to lowercase.

### comment:6 Changed 5 years ago by Ryan J Ollos

Resolution: → fixed accepted → closed

In 16413:

2.2.1dev: Account for all option names converted to lowercase

Fixes #13099.

### comment:7 in reply to:  2 Changed 3 years ago by Ryan J Ollos

I will either have to roll with my little hack or go through and sanitize all the existing user accounts. This is just a "non time consuming" side project for at work so if there is a quick and easy way of fixing existing user names, I would appreciate pointers/guidance/link.

It would probably be rather difficult to change the usernames due to the number of tables that store username. Username is stored in columns named username, author, sid, owner (and possibly others): wiki:TracDev/DatabaseSchema#DatabaseSchemaTrac0.12.

### comment:8 Changed 3 years ago by Ryan J Ollos

r16413 contains a regression reported in #13609.

### comment:9 Changed 3 years ago by Ryan J Ollos

In 17526:

TracDynamicFields 2.3.0dev: Account for all option names converted to lowercase

This should resolve issues introduced in r16413.

Refs #13099, #13609.

### Modify Ticket

Change Properties