Modify

Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#13099 closed defect (fixed)

SetRule and username case sensitivity

Reported by: christiano@… Owned by: Ryan J Ollos
Priority: normal Component: DynamicFieldsPlugin
Severity: normal Keywords: owner set_to restrict_owner
Cc: Trac Release: 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;
       }
     });

Attachments (0)

Change History (9)

comment:1 Changed 7 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 7 years ago by Ryan J Ollos (previous) (diff)

comment:2 in reply to:  1 ; Changed 7 years ago by christiano@…

Replying to 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?

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 7 years ago by Ryan J Ollos

Thanks, I will do some testing.

comment:4 Changed 7 years ago by Ryan J Ollos

Status: newaccepted

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

Replying to Ryan J Ollos:

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 7 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 16413:

2.2.1dev: Account for all option names converted to lowercase

Fixes #13099.

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

Replying to christiano@…:

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 5 years ago by Ryan J Ollos

r16413 contains a regression reported in #13609.

comment:9 Changed 5 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
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.