Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12913 closed defect (fixed)

Wrong error message on start after update from 1.2 to 1.2.2

Reported by: Dirk Stöcker Owned by: Jun Omae
Priority: normal Milestone: 1.2.3
Component: general Version: 1.2.2
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fixed incorrect logging of negated permission as invalid in AuthzPolicy.

API Changes:
Internal Changes:

Description

Hi, I updated our trac from 1.2 to 1.2.2 and get following start message:

Trac[authz_policy] WARNING: The action !WIKI_MODIFY in the [wiki:...] section of fineperm.conf is not a valid action.

based on the line:

* = !WIKI_MODIFY

in fineperm.conf

Actually the line still works correctly, so I assume some sanity check does not properly recognize the "!" syntax.

Attachments (0)

Change History (4)

comment:1 by Jun Omae, 7 years ago

Milestone: 1.2.3

Thanks for the reporting! It seems that is regression of #12734.

  • tracopt/perm/authz_policy.py

    diff --git a/tracopt/perm/authz_policy.py b/tracopt/perm/authz_policy.py
    index d8c1ba9ef..7bd4921ee 100644
    a b class AuthzPolicy(Component):  
    204204        for group, users in groups.iteritems():
    205205            add_items('@' + group, users)
    206206
    207         all_actions = PermissionSystem(self.env).get_actions()
     207        all_actions = set(PermissionSystem(self.env).get_actions())
     208        authz_basename = os.path.basename(self.authz_file)
    208209        for section in self.authz.sections():
    209210            if section == 'groups':
    210211                continue
    211212            for _, actions in self.authz.items(section):
    212213                for action in to_list(actions):
     214                    if action.startswith('!'):
     215                        action = action[1:]
    213216                    if action not in all_actions:
    214217                        self.log.warning("The action %s in the [%s] section "
    215218                                         "of %s is not a valid action.",
    216                                          action, section,
    217                                          os.path.basename(self.authz_file))
     219                                         action, section, authz_basename)
    218220
    219221    def normalise_resource(self, resource):
    220222        def to_descriptor(resource):

Also, we should add unit tests with !ACTION. Missing tests for that.

Last edited 7 years ago by Jun Omae (previous) (diff)

comment:2 by Ryan J Ollos, 7 years ago

Owner: set to Ryan J Ollos
Status: newassigned

Committed the comment:1 patch in r16336, merged to trunk in r16337.

Proposed additions to test coverage in [2556a86ad/rjollos.git]. This is targeted to trunk since we have a mock logger that captures messages in-memory.

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

comment:3 by Ryan J Ollos, 7 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

comment:2 changes committed to trunk in r16343.

comment:4 by Ryan J Ollos, 7 years ago

Owner: changed from Ryan J Ollos to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.