Edgewall Software

Changes between Initial Version and Version 1 of Ticket #11559


Ignore:
Timestamp:
Mar 25, 2014, 2:15:49 AM (10 years ago)
Author:
Ryan J Ollos
Comment:

I was too hasty in putting together the previous patch. I'll post a tested patch shortly.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11559 – Description

    initial v1  
    11It was discussed on the [https://groups.google.com/d/msg/trac-dev/CsqJhgJHnxk/CUWmbUy9acsJ mailing list] whether permission checks performed in CommitTicketUpdater should take into account the `[trac] ignore_auth_case` parameter. The authorization currently fails checking for `TICKET_APPEND` when the username in Subversion differs from that in Trac by casing.
    2 
    3 A simple patch that would make CommitTicketUpdater account for `[trac] ignore_auth_case` is:
    4 {{{#!diff
    5 diff --git a/tracopt/ticket/commit_updater.py b/tracopt/ticket/commit_updater.py
    6 index 1f16ce6..81f1139 100644
    7 --- a/tracopt/ticket/commit_updater.py
    8 +++ b/tracopt/ticket/commit_updater.py
    9 @@ -209,7 +209,10 @@ In [changeset:"%s"]:
    10  
    11      def _update_tickets(self, tickets, changeset, comment, date):
    12          """Update the tickets with the given comment."""
    13 -        perm = PermissionCache(self.env, changeset.author)
    14 +        author = changeset.author.lower() \
    15 +                 if self.env.config.get('trac', 'ignore_auth_case') \
    16 +                 else changeset.author
    17 +        perm = PermissionCache(self.env, author)
    18          for tkt_id, cmds in tickets.iteritems():
    19              try:
    20                  self.log.debug("Updating ticket #%d", tkt_id)
    21 }}}
    22 
    23 The patch was quickly rewritten from memory so technically it's untested, but when I tested that (or a very similar) patch a few days ago it seemed to do the job. I'll do some additional testing. As a first step I was hoping to get feedback from the other devs as to whether this is the right approach to solving the issue.