Created
October 13, 2011 08:30
-
-
Save batkinson/1283742 to your computer and use it in GitHub Desktop.
Patch for trac-backlog #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -urN trac-backlog-0.2.2/backlog/web_ui.py trac-backlog-0.2.2-readonly-without-perms/backlog/web_ui.py | |
--- trac-backlog-0.2.2/backlog/web_ui.py 2011-10-10 13:09:39.000000000 +0000 | |
+++ trac-backlog-0.2.2-readonly-without-perms/backlog/web_ui.py 2011-10-13 07:54:37.261926597 +0000 | |
@@ -10,6 +10,7 @@ | |
from trac.core import * | |
from trac.db import DatabaseManager | |
from trac.env import IEnvironmentSetupParticipant | |
+from trac.perm import IPermissionRequestor | |
from trac.ticket.api import ITicketChangeListener | |
from trac.ticket.model import Ticket | |
from trac.web.chrome import INavigationContributor, ITemplateProvider | |
@@ -50,7 +51,7 @@ | |
class BacklogPlugin(Component): | |
implements(INavigationContributor, IRequestHandler, | |
IEnvironmentSetupParticipant, ITemplateProvider, | |
- ITicketChangeListener) | |
+ ITicketChangeListener, IPermissionRequestor) | |
# IEnvironmentSetupParticipant | |
def environment_created(self): | |
@@ -120,6 +121,9 @@ | |
db.commit() | |
# INavigationContributor methods | |
+ def get_permission_actions(self): | |
+ return ['BACKLOG_ADMIN'] | |
+ | |
def get_active_navigation_item(self, req): | |
return 'backlog' | |
@@ -164,9 +168,11 @@ | |
return False | |
def process_request(self, req): | |
+ mod_perms = ['TICKET_MODIFY','BACKLOG_ADMIN'] | |
req.perm.require('TICKET_VIEW') | |
if req.method == 'POST': | |
- req.perm.require('TICKET_MODIFY') | |
+ for perm in mod_perms: | |
+ req.perm.require(perm) | |
if 'move_after' in req.path_info: | |
return self._move_after(req) | |
@@ -198,7 +204,7 @@ | |
data['active_milestones'] = self._get_active_milestones(milestone) | |
data['base_path'] = req.base_path | |
- if 'TICKET_MODIFY' in req.perm: | |
+ if mod_perms <= req.perm: | |
data['allow_sorting'] = True | |
add_stylesheet(req, 'backlog/css/backlog.css') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment