Completed

#0251 View only instance  

Is it possible to have a view only instance of issue tracker, so noone can add issues?

Or in other words is it possible to hide the Add Issue, Quick Add Issue from the top tab menu?

The reason to do that, is when there is a 'host' instance that displays other 'brother' instances of issue trackers we don't want users to be able to add issues to the 'host' instance, but only in the original 'brother' issues.

P.S. There is already an option to customise the bottom links from StandardHeader.zpt and showCheckoutableTemplates (just mentioned here for completeness)

Submitted by: <Kosmas Chatzimichalis>
08-Feb 2006
2 years and 4 months and 3 weeks old
Sections:User functions
Type:usability
Urgency:normal
 
Added Issue followup   -   <Peter Bengtsson> permanent link

It can be done with permissions. Sort of. There's a permission called "Add Issue Tracker Issues" which you can disable for these kind of people. But that doesn't solve the whole problem. You'll need to write a monkey patch to solve  the problem and patch the _getMenuItems() function.

 Your issuetracker probably has a self.menu_items that looks like this:

 [
 {'href': '/', 'inurl': '', 'label': 'Home'},
 {'href': '/AddIssue', 'inurl': ('AddIssue', 'SaveDraftIssue'), 'label': 'Add Issue'},
 {'href': '/QuickAddIssue', 'inurl': 'QuickAddIssue', 'label': 'Quick Add Issue'},
 {'href': '/ListIssues', 'inurl': 'ListIssues', 'label': 'List Issues'},
 {'href': '/CompleteList', 'inurl': 'CompleteList', 'label': 'Complete List'}
]

What you can do is monkey patch _getMenuItems() for something like this:

 from Products.IssueTrackerProduct.IssueTracker import IssueTracker
 from Products.IssueTrackerProduct.Constants import DEFAULT_MENU_ITEMS
 def better_getMenuItems(self):
      if hasattr(self, 'getCustomMenuItems'):
          return self.getCustomMenuItems()
      else:
          return getattr(self, 'menu_items', DEFAULT_MENU_ITEMS)
 IssueTracker._getMenuItems = better_getMenuItems

Once you've done that, you can, inside any issuetracker instance, create a python script called "getCustomMenuItems" which looks like this::

return  [
 {'href': '/', 'inurl': '', 'label': 'Home'},
  #{'href': '/AddIssue', 'inurl': ('AddIssue', 'SaveDraftIssue'), 'label': 'Add Issue'},
  #{'href': '/QuickAddIssue', 'inurl': 'QuickAddIssue', 'label': 'Quick Add Issue'},
 {'href': '/ListIssues', 'inurl': 'ListIssues', 'label': 'List Issues'},
 {'href': '/CompleteList', 'inurl': 'CompleteList', 'label': 'Complete List'}
]

For more info on monkey patching, see this page http://www.issuetrackerproduct.com/Documentation/How-Tos/monkey-patching

 

08-Feb 2006
 
Added Issue followup   -   <Kosmas Chatzimichalis> permanent link

Thanks Peter,

I will try that, but would that cause any problem with future upgrades?

Would I have to do the same for a future release or it will only break if a specific piece of the code (_getMenuItems) changes in a future release?

Sorry for the ignorance, but haven't had experience with monkey patching before!

Thanks

08-Feb 2006
 
Added Issue followup   -   <Peter Bengtsson> permanent link
It's unlikely to change but if it changes it won't be too hard to fix again.
09-Feb 2006
 
Changed status from Open to Completed   -   <Peter Bengtsson> permanent link

I hope you didn't spend too much time already on a monkey patch

Check this out

24-Feb 2006
 
Added Issue followup   -   <Kosmas Chatzimichalis> permanent link

That looks very nice indeed Pete :-)
Exactly what I was looking for.

Fortunately I was busy with other things, so I didn't have the time to do the 'monkey patch'!

Excellent, thanks a lot and well done !

P.S. Didn't have time to check the other issues. I'll report back if there's anything.

24-Feb 2006
 
Name:
Email:
Spambot prevention:number?number?number?number? enter these numbers
File attachment:
File attachment:
Hide again hide file attachments
(<Kosmas Chatzimichalis>, <Peter Bengtsson>)
Tell a Friend [with more options]

Subscription to changes

 
 

Recent issues