#11152 closed enhancement (fixed)
The "View Tickets" mainnav entry should be a link to the query page when the user possesses TICKET_VIEW but not REPORT_VIEW
Reported by: | Owned by: | Ryan J Ollos | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.2 |
Component: | query system | Version: | 1.0-stable |
Severity: | normal | Keywords: | permissions report query navigation |
Cc: | Branch: | ||
Release Notes: |
The View Tickets mainnav item links to the |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
The View Tickets mainnav entry links to the /report
page, both of which are only displayed if the user has the REPORT_VIEW
permission. TICKET_VIEW
is the only permission required to view the /query
page, however if the user doesn't have REPORT_VIEW
, there is no direct way to navigate to the /query
page.
I think it would make sense to have the View Tickets mainnav entry link to the /query
page when the user has TICKET_VIEW
, but does not have REPORT_VIEW
.
Attachments (0)
Change History (11)
comment:1 by , 12 years ago
Milestone: | → next-stable-1.0.x |
---|
comment:2 by , 12 years ago
Description: | modified (diff) |
---|
follow-up: 4 comment:3 by , 12 years ago
293d59cf implements the behavior discussed in comment:description, followed by a minor refactoring 8531b6a8.
It looks to me that Component.config
is an in-memory object that is not recreated as the result of a Configuration.set
or even a Configuration.save
method call. Therefore, I can't see a reason to call Configuration.save
within a test in which we only want the configuration to persist within the scope of the test case. If that makes sense, it would suggest that in the following we could drop the "save".
env = self._testenv.get_trac_environment() env.config.set(...) env.config.save() try: ... finally: env.config.remove(...)
It also seems unnecessary to call self._testenv.restart() after a configuration change.
I'll wait for feedback on those two issues before making the changes.
comment:4 by , 12 years ago
Replying to Ryan J Ollos <ryan.j.ollos@…>:
It looks to me that
Component.config
is an in-memory object that is not recreated as the result of aConfiguration.set
or even aConfiguration.save
method call.
I think I was wrong about this, since additional testing has shown that the save
calls can't be removed. I'll have to look at it in more detail later to understand it better.
comment:5 by , 11 years ago
Milestone: | next-stable-1.0.x → 1.0.2 |
---|---|
Owner: | set to |
Status: | new → assigned |
comment:6 by , 11 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Committed to 1.0-stable in [11824].
follow-up: 10 comment:7 by , 10 years ago
In [13053], fixed incorrect test name from [11824]. Merged in [13054].
Also, I'm thinking that the following is equivalent, but the intention is more clear:
-
trac/ticket/query.py
commit 295c6c3df54981499155e263f265ab81643e62b8 Author: rjollos <ryan.j.ollos@gmail.com> Date: Wed Jul 30 08:55:33 2014 -0700 More readable expression. diff --git a/trac/ticket/query.py b/trac/ticket/query.py index 44c225c..0132abd 100644
a b class QueryModule(Component): 882 882 def get_navigation_items(self, req): 883 883 from trac.ticket.report import ReportModule 884 884 if 'TICKET_VIEW' in req.perm and \ 885 not (self.env.is_component_enabled(ReportModule) and886 'REPORT_VIEW'in req.perm):885 (not self.env.is_component_enabled(ReportModule) or 886 'REPORT_VIEW' not in req.perm): 887 887 yield ('mainnav', 'tickets', 888 888 tag.a(_('View Tickets'), href=req.href.query()))
follow-up: 11 comment:8 by , 10 years ago
I've replaced the functional test with unit tests and added the refactoring from comment:7 in log:rjollos.git:t11152. The unit tests might then be extended to test fine-grained permission checks for the navigation contributor proposed in #11697. However, I'll wait until milestone:1.0.3 before committing these changes. Please let me know if any reasons are seen for keeping the functional test rather than the unit tests.
comment:9 by , 10 years ago
It's pretty ugly having to check whether another navigation item has been added by checking if the component is enabled and the user has the appropriate permission. I wonder how generally applicable a Priority value would be. For the case shown in comment:7, QueryModule
would return a navigation item named ticket
that has less priority than the one return by ReportModule
(i.e. won't be present when the navigation item from ReportModule
is present). Another case of overriding can be found with the ExtendedVersionPlugin.
comment:10 by , 10 years ago
Replying to rjollos:
Also, I'm thinking that the following is equivalent, but the intention is more clear:
trac/ticket/query.py
commit 295c6c3df54981499155e263f265ab81643e62b8 Author: rjollos <ryan.j.ollos@gmail.com> Date: Wed Jul 30 08:55:33 2014 -0700 More readable expression. diff --git a/trac/ticket/query.py b/trac/ticket/query.py index 44c225c..0132abd 100644
a b class QueryModule(Component): 882 882 def get_navigation_items(self, req): 883 883 from trac.ticket.report import ReportModule 884 884 if 'TICKET_VIEW' in req.perm and \ 885 not (self.env.is_component_enabled(ReportModule) and886 'REPORT_VIEW'in req.perm):885 (not self.env.is_component_enabled(ReportModule) or 886 'REPORT_VIEW' not in req.perm): 887 887 yield ('mainnav', 'tickets', 888 888 tag.a(_('View Tickets'), href=req.href.query()))
Committed to 1.0-stable in [13233], merged to trunk in [13234].
comment:11 by , 10 years ago
Replying to rjollos:
I've replaced the functional test with unit tests and added the refactoring from comment:7 in log:rjollos.git:t11152.
Committed to 1.0-stable in [13241], merged to trunk in [13242].
Right, that's already what happens when the report module is disabled.