With regards to a custom permission policy, I'd be interested in learning how to implement it to achieve the desired behavior.
restore |
|
-- You received this message because you are subscribed to the Google Groups "Trac Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com. To post to this group, send email to trac-...@googlegroups.com. Visit this group at http://groups.google.com/group/trac-users. For more options, visit https://groups.google.com/d/optout. |
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
Contents of setup.py
from setuptools import setup, find_packages
setup(name='ReadonlySignedTickets',
version='1.0',
packages = find_packages(),
)
Contents of ReadonlySignedTickets.pyfrom trac.core import *
from trac.perm import IPermissionPolicy
from trac.ticket.model import Ticket
class ReadonlySignedTickets(Component):
implements(IPermissionPolicy)
def check_permission(self, action, username, resource, perm):
if resource is None or resource.realm != 'ticket' or \
resource.id is None or action == 'TICKET_VIEW' or \
'TRAC_ADMIN' in perm:
return None
t = Ticket(self.env, resource.id)
if t['resolution'] == 'Signed':
return FalseI do see how this bit of code matches the requisites for a plugin, however I don't have experience using setup tools to accomplish this task. I do however have setup tools installed. Nevertheless, practical steps would be extremely appreciated!Resources:
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
Thanks Ryan and Olemis,What steps are necessary to ensure the plugin is actively being considered by Trac? Do I need to make any modifications to the trac.ini?

{{{ from trac.core import *
from trac.perm import IPermissionPolicy
from trac.ticket.model import Ticket
class ReadonlySignedTickets(Component):
implements(IPermissionPolicy)
def check_permission(self, action, username, resource, perm):
if resource is None or resource.realm != 'ticket' or \
resource.id is None or action == 'TICKET_VIEW' or \
'TRAC_ADMIN' in perm:
return None
t = Ticket(self.env, resource.id)
if t['resolution'] == 'Signed':
return False
2014-07-27 15:46:45,022 Trac[main] DEBUG: Dispatching <RequestWithSession "POST '/ticket/1968'">
2014-07-27 15:46:45,025 Trac[session] DEBUG: Retrieving session for ID u'temp1'
2014-07-27 15:46:45,032 Trac[main] DEBUG: Negotiated locale: None -> en_US
2014-07-27 15:46:45,049 Trac[blackmagic] DEBUG: Validating ticket: 1968
2014-07-27 15:46:45,049 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADD_HOURS', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:45,049 Trac[blackmagic] DEBUG: Checking permission TICKET_ADD_HOURS
2014-07-27 15:46:45,049 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_ADD_HOURS on <Resource u'ticket:1968'>
2014-07-27 15:46:45,050 Trac[blackmagic] DEBUG: totalhours disabled or hidden
2014-07-27 15:46:45,054 Trac[blackmagic] DEBUG: OT: 0
2014-07-27 15:46:45,054 Trac[blackmagic] DEBUG: NEW: 0
2014-07-27 15:46:45,054 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TRAC_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:45,055 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:45,055 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:45,055 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_ADMIN on <Resource u'ticket:1968'>
2014-07-27 15:46:45,056 Trac[blackmagic] DEBUG: component disabled or hidden
2014-07-27 15:46:45,060 Trac[blackmagic] DEBUG: OT: General Requests
2014-07-27 15:46:45,060 Trac[blackmagic] DEBUG: NEW: General Requests
2014-07-27 15:46:45,060 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:45,060 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:45,061 Trac[blackmagic] DEBUG: priority disabled or hidden
2014-07-27 15:46:45,065 Trac[blackmagic] DEBUG: OT: High
2014-07-27 15:46:45,065 Trac[blackmagic] DEBUG: NEW: High
2014-07-27 15:46:45,065 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:45,066 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:45,066 Trac[blackmagic] DEBUG: parents disabled or hidden
2014-07-27 15:46:45,070 Trac[blackmagic] DEBUG: OT:
2014-07-27 15:46:45,070 Trac[blackmagic] DEBUG: NEW:
2014-07-27 15:46:45,071 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': '', 'tip': u'Unless you know who should own this ticket, please leave this field default.', 'label': None, 'ondenial': 'disable', 'disable': False}
2014-07-27 15:46:45,071 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADD_HOURS', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:45,071 Trac[blackmagic] DEBUG: Checking permission TICKET_ADD_HOURS
2014-07-27 15:46:45,071 Trac[blackmagic] DEBUG: estimatedhours disabled or hidden
2014-07-27 15:46:45,076 Trac[blackmagic] DEBUG: OT: 0
2014-07-27 15:46:45,076 Trac[blackmagic] DEBUG: NEW: 0
2014-07-27 15:46:45,076 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:45,077 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:45,077 Trac[blackmagic] DEBUG: type disabled or hidden
2014-07-27 15:46:45,081 Trac[blackmagic] DEBUG: OT: Task
2014-07-27 15:46:45,081 Trac[blackmagic] DEBUG: NEW: Task
2014-07-27 15:46:45,090 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_ADD_HOURS on None
2014-07-27 15:46:45,114 Trac[notification] INFO: Sending notification through SMTP at exsmtp.na.bayer.cnb:25 to [u'jared....@bayer.com', u'te...@bayer.com']
2014-07-27 15:46:45,983 Trac[web_ui] DEBUG: Side effect for ConfigurableTicketWorkflow
2014-07-27 15:46:46,656 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/ticket/1968'">
2014-07-27 15:46:46,659 Trac[session] DEBUG: Retrieving session for ID u'temp1'
2014-07-27 15:46:46,665 Trac[main] DEBUG: Negotiated locale: None -> en_US
2014-07-27 15:46:46,686 Trac[default_workflow] DEBUG: render_ticket_action_control: action "leave"
2014-07-27 15:46:46,687 Trac[default_workflow] DEBUG: render_ticket_action_control: action "reopen"
2014-07-27 15:46:46,694 Trac[chrome] DEBUG: Prepare chrome data for request
2014-07-27 15:46:46,697 Trac[perm] DEBUG: No policy allowed temp1 performing ACCTMGR_CONFIG_ADMIN on None
2014-07-27 15:46:46,697 Trac[perm] DEBUG: No policy allowed temp1 performing ACCTMGR_USER_ADMIN on None
2014-07-27 15:46:46,697 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_ADMIN on None
2014-07-27 15:46:46,698 Trac[perm] DEBUG: No policy allowed temp1 performing REPORT_ADMIN on None
2014-07-27 15:46:46,698 Trac[perm] DEBUG: No policy allowed temp1 performing TRAC_ADMIN on None
2014-07-27 15:46:46,698 Trac[perm] DEBUG: No policy allowed temp1 performing PERMISSION_GRANT on None
2014-07-27 15:46:46,699 Trac[perm] DEBUG: No policy allowed temp1 performing PERMISSION_REVOKE on None
2014-07-27 15:46:46,699 Trac[perm] DEBUG: No policy allowed temp1 performing MILESTONE_VIEW on None
2014-07-27 15:46:46,699 Trac[perm] DEBUG: No policy allowed temp1 performing VERSIONCONTROL_ADMIN on None
2014-07-27 15:46:46,701 Trac[perm] DEBUG: No policy allowed temp1 performing ROADMAP_VIEW on None
2014-07-27 15:46:46,701 Trac[perm] DEBUG: No policy allowed temp1 performing TIMELINE_VIEW on None
2014-07-27 15:46:46,702 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_VIEW_HOURS on None
2014-07-27 15:46:46,706 Trac[blackmagic] DEBUG: Checking ticket permissions for type Enhancement
2014-07-27 15:46:46,707 Trac[blackmagic] DEBUG: User temp1 has permission
2014-07-27 15:46:46,707 Trac[blackmagic] DEBUG: Checking ticket permissions for type Defect
2014-07-27 15:46:46,707 Trac[blackmagic] DEBUG: User temp1 has permission
2014-07-27 15:46:46,707 Trac[blackmagic] DEBUG: Checking ticket permissions for type Task
2014-07-27 15:46:46,707 Trac[blackmagic] DEBUG: User temp1 has permission
2014-07-27 15:46:46,709 Trac[blackmagic] DEBUG: Permissions TICKET_ADD_HOURS
2014-07-27 15:46:46,709 Trac[blackmagic] DEBUG: Checking permission TICKET_ADD_HOURS
2014-07-27 15:46:46,709 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_ADD_HOURS on <Resource u'ticket:1968'>
2014-07-27 15:46:46,711 Trac[blackmagic] DEBUG: Permissions TRAC_ADMIN
2014-07-27 15:46:46,711 Trac[blackmagic] DEBUG: Checking permission TRAC_ADMIN
2014-07-27 15:46:46,711 Trac[perm] DEBUG: No policy allowed temp1 performing TRAC_ADMIN on <Resource u'ticket:1968'>
2014-07-27 15:46:46,712 Trac[blackmagic] DEBUG: Permissions TICKET_ADMIN
2014-07-27 15:46:46,713 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:46,713 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_ADMIN on <Resource u'ticket:1968'>
2014-07-27 15:46:46,714 Trac[blackmagic] DEBUG: Permissions TICKET_ADMIN
2014-07-27 15:46:46,714 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:46,716 Trac[blackmagic] DEBUG: Permissions TICKET_ADMIN
2014-07-27 15:46:46,716 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:46,718 Trac[blackmagic] DEBUG: Permissions TICKET_ADD_HOURS
2014-07-27 15:46:46,718 Trac[blackmagic] DEBUG: Checking permission TICKET_ADD_HOURS
2014-07-27 15:46:46,719 Trac[blackmagic] DEBUG: Permissions TICKET_ADMIN
2014-07-27 15:46:46,720 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:46,925 Trac[main] DEBUG: Dispatching <RequestWithSession "POST '/ticket/1968'">
2014-07-27 15:46:46,928 Trac[session] DEBUG: Retrieving session for ID u'temp1'
2014-07-27 15:46:46,936 Trac[main] DEBUG: Negotiated locale: None -> en_US
2014-07-27 15:46:46,940 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_EDIT_COMMENT on <Resource u'ticket:1968'>
2014-07-27 15:46:46,952 Trac[chrome] DEBUG: Prepare chrome data for request
2014-07-27 15:46:46,955 Trac[perm] DEBUG: No policy allowed temp1 performing ACCTMGR_CONFIG_ADMIN on None
2014-07-27 15:46:46,955 Trac[perm] DEBUG: No policy allowed temp1 performing ACCTMGR_USER_ADMIN on None
2014-07-27 15:46:46,955 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_ADMIN on None
2014-07-27 15:46:46,956 Trac[perm] DEBUG: No policy allowed temp1 performing REPORT_ADMIN on None
2014-07-27 15:46:46,956 Trac[perm] DEBUG: No policy allowed temp1 performing TRAC_ADMIN on None
2014-07-27 15:46:46,956 Trac[perm] DEBUG: No policy allowed temp1 performing PERMISSION_GRANT on None
2014-07-27 15:46:46,957 Trac[perm] DEBUG: No policy allowed temp1 performing PERMISSION_REVOKE on None
2014-07-27 15:46:46,957 Trac[perm] DEBUG: No policy allowed temp1 performing MILESTONE_VIEW on None
2014-07-27 15:46:46,957 Trac[perm] DEBUG: No policy allowed temp1 performing VERSIONCONTROL_ADMIN on None
2014-07-27 15:46:46,959 Trac[perm] DEBUG: No policy allowed temp1 performing ROADMAP_VIEW on None
2014-07-27 15:46:46,959 Trac[perm] DEBUG: No policy allowed temp1 performing TIMELINE_VIEW on None
2014-07-27 15:46:46,960 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_VIEW_HOURS on None
2014-07-27 15:46:46,960 Trac[blackmagic] DEBUG: Validating ticket: 1968
2014-07-27 15:46:46,961 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADD_HOURS', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:46,961 Trac[blackmagic] DEBUG: Checking permission TICKET_ADD_HOURS
2014-07-27 15:46:46,961 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_ADD_HOURS on <Resource u'ticket:1968'>
2014-07-27 15:46:46,962 Trac[blackmagic] DEBUG: totalhours disabled or hidden
2014-07-27 15:46:46,966 Trac[blackmagic] DEBUG: OT: 0
2014-07-27 15:46:46,966 Trac[blackmagic] DEBUG: NEW: 0
2014-07-27 15:46:46,966 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TRAC_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:46,967 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:46,967 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:46,967 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_ADMIN on <Resource u'ticket:1968'>
2014-07-27 15:46:46,967 Trac[blackmagic] DEBUG: component disabled or hidden
2014-07-27 15:46:46,972 Trac[blackmagic] DEBUG: OT: General Requests
2014-07-27 15:46:46,972 Trac[blackmagic] DEBUG: NEW: General Requests
2014-07-27 15:46:46,972 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:46,972 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:46,973 Trac[blackmagic] DEBUG: priority disabled or hidden
2014-07-27 15:46:46,977 Trac[blackmagic] DEBUG: OT: High
2014-07-27 15:46:46,977 Trac[blackmagic] DEBUG: NEW: High
2014-07-27 15:46:46,977 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:46,978 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:46,978 Trac[blackmagic] DEBUG: parents disabled or hidden
2014-07-27 15:46:46,982 Trac[blackmagic] DEBUG: OT:
2014-07-27 15:46:46,982 Trac[blackmagic] DEBUG: NEW:
2014-07-27 15:46:46,983 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': '', 'tip': u'Unless you know who should own this ticket, please leave this field default.', 'label': None, 'ondenial': 'disable', 'disable': False}
2014-07-27 15:46:46,983 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADD_HOURS', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:46,983 Trac[blackmagic] DEBUG: Checking permission TICKET_ADD_HOURS
2014-07-27 15:46:46,983 Trac[blackmagic] DEBUG: estimatedhours disabled or hidden
2014-07-27 15:46:46,988 Trac[blackmagic] DEBUG: OT: 0
2014-07-27 15:46:46,988 Trac[blackmagic] DEBUG: NEW: 0
2014-07-27 15:46:46,988 Trac[blackmagic] DEBUG: {'notice': None, 'hide': False, 'permission': u'TICKET_ADMIN', 'tip': None, 'label': None, 'ondenial': u'hide', 'disable': False}
2014-07-27 15:46:46,989 Trac[blackmagic] DEBUG: Checking permission TICKET_ADMIN
2014-07-27 15:46:46,989 Trac[blackmagic] DEBUG: type disabled or hidden
2014-07-27 15:46:46,993 Trac[blackmagic] DEBUG: OT: Task
2014-07-27 15:46:46,994 Trac[blackmagic] DEBUG: NEW: Task
2014-07-27 15:46:47,002 Trac[default_workflow] DEBUG: render_ticket_action_control: action "leave"
2014-07-27 15:46:47,002 Trac[default_workflow] DEBUG: render_ticket_action_control: action "reopen"
2014-07-27 15:46:47,014 Trac[perm] DEBUG: No policy allowed temp1 performing TICKET_EDIT_COMMENT on <Resource u'ticket:1968'>
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
On 28.07.2014 01:01, Jared Bownds wrote:
> Thanks for the feedback, i'm now confident ReadonlySignedTickets.py is
> enabled as a plugin.
>
> I've run a few tests on the code below. I created a user called temp1
> that does not have TRAC_ADMIN privileges. Also, I created a request
> (#1968) and resolved it as signed. While the permissions feedback
> provided by the trac log indicates the user does not have the necessary
> permissions to comment on the ticket, I am still able to modify the
> request as user temp1. I would appreciate feedback on
> ReadonlySignedTickets.py to try and identify why the desired behavior is
> not functioning.
Permission policy plugins also need to be listed in the trac.ini config
file under [trac] permission_policies. For example if you previously
only had the current default policies, add ReadonlySignedTickets to the
front of the list:
[trac]
permission_policies = ReadonlySignedTickets, ReadonlyWikiPolicy,
DefaultPermissionPolicy, LegacyAttachmentPolicy
(Note that the order can be important!)
Hope this helps.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+unsubscribe@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+unsubscribe@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
You nailed it! The code below works. However, users are still able to 'edit' their own comments once a ticket is resolved as signed.
{{{
from trac.core import *
from trac.perm import IPermissionPolicy
from trac.ticket.model import Ticket
class ReadonlySignedTickets(Component):
implements(IPermissionPolicy)
def check_permission(self, action, username, resource, perm):
if resource is None or resource.realm != 'ticket' or \
resource.id is None or action == 'TICKET_VIEW' or \
action == 'TRAC_ADMIN' or 'TRAC_ADMIN' in perm:
return None
t = Ticket(self.env, resource.id)
if t['resolution'] == 'signed':
return False
}}}
Next, how do we implement the desired error feedback outlined below?
- Visually distinguish tickets resolved as 'Signed' by either slightly changing the color of the description body, or add a draft style 'SIGNED' watermark to the right and left side of the description body.
site.html<html xmlns="http://www.w3.org/1999/xhtml"xmlns:py="http://genshi.edgewall.org/"py:strip=""><!--! Add site-specific style sheet --><head py:match="head" py:attrs="select('@*')">${select('*|comment()|text()')}<link rel="stylesheet" type="text/css"href="${href.chrome('site/style.css')}" /></head><body py:match="body" py:attrs="select('@*')"><!--! Add site-specific header --><div id="siteheader"><!--! Place your header content here... --></div>${select('*|text()')}<!--! Add site-specific footer --><div id="sitefooter"><!--! Place your footer content here... --></div></body></html>
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
On Mon, Jul 28, 2014 at 10:55 AM, Jared Bownds <jared....@gmail.com> wrote:
You nailed it! The code below works. However, users are still able to 'edit' their own comments once a ticket is resolved as signed.{{{from trac.core import *
from trac.perm import IPermissionPolicy
from trac.ticket.model import Ticket
class ReadonlySignedTickets(Component):
implements(IPermissionPolicy)
def check_permission(self, action, username, resource, perm):
if resource is None or resource.realm != 'ticket' or \
resource.id is None or action == 'TICKET_VIEW' or \
action == 'TRAC_ADMIN' or 'TRAC_ADMIN' in perm:
return None
t = Ticket(self.env, resource.id)
if t['resolution'] == 'signed':
return False
}}}Peter's plugin shown above work for me on 1.0-stable, and users aren't able to edit comments even if they have been granted TICKET_ADMIN. I used resolution //signed// rather than //Signed// since all of Trac's predefined resolutions are in lowercase.
Which Trac version are you running?
I'm running version 1.0

--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
Hi Ryan,
I'm using style.css, and it does show up in the source.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
I left out a step:
[ticket]
decorate_fields = resolutionI added to trac.ini, it's still not working. I'm at a loss as to why it's not working.[ticket]
decorate_fields = resolution
Here is a snippet from the log
2014-07-28 13:53:09,218 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/site/style.css'">2014-07-28 13:53:09,219 Trac[chrome] DEBUG: Prepare chrome data for request2014-07-28 13:53:09,220 Trac[session] DEBUG: Retrieving session for ID u'jbownds'2014-07-28 13:53:09,222 Trac[main] DEBUG: Negotiated locale: None -> en_US2014-07-28 13:53:09,342 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/ticketvalidator.options'">2014-07-28 13:53:09,343 Trac[chrome] DEBUG: Prepare chrome data for request2014-07-28 13:53:09,345 Trac[session] DEBUG: Retrieving session for ID u'jbownds'2014-07-28 13:53:09,347 Trac[main] DEBUG: Negotiated locale: None -> en_US
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
I think your onto something, the plugin may not be loading. Has anyone encountered this error before? Also, I opened a ticket regarding the error.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
DevayedWiki was causing a problem, thanks for pointing that out - below is my configuration in trac.iniI'm still not sure why it's not working. Do you have any other ideas on what I can check?
[components]contextchrome.cors.crossoriginresourcesharingenabler = disabledcontextchrome.linkdeco.internalstylesheet = disabledcontextchrome.linkdeco.intertracticketlinkdecorator = disabledcontextchrome.linkdeco.ticketlinkdecorator = disabledcontextchrome.linkdeco.wikilinknewdecolator = disabledcontextchrome.style.typeclasstoticket = enabledcontextchrome.ticketvalidator.ticketvalidatordecolator = disabled
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
Is that not the following?Trac[loader] DEBUG: Loading ContextChrome from /srv/trac/trac/plugins/ContextChrome-0.3-py2.6.egg
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
Reference: http://trac-hacks.org/ticket/11885I am looking for a solution that will work like this:
- Create a new permission group called SIGNER
- Add 'signed' as a resolution type
- Users with permission SIGNER are allowed to resolve a request as 'Signed'
Desired behavior:
- Once a ticket is resolved as 'Signed', the ticket is now read only except to TRAC_ADMIN
- Users without TRAC_ADMIN permissions are unable to modify the ticket in any way. When an attempt is made, the user should receive an error upon save indicating the ticket is signed and therefore read only.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
Hi Ryan,ReadonlySignedTickets.py (outlined below) is not working for me. Moreover, I can tell in the Trac log that the plugin is being considered.I've tried both if t['resolution'] == 'Signed': and if t['resolution'] == 'signed':
Hi Jared,
we need a similar solution. In our case, it's probably named "released" (instead of "signed"). The use-case is that nobody should change ticket properties when the ticket is released (only commenting).
Have you created a Trac-Plugin on Trac-hacks [1] for that solution?
Thank you,
Franz
[1] http://trac-hacks.org/
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
Hi Ryan,
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
When enabling the plugin I can see it's is being loaded successfully. You said the code below works properly for you?

--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+unsubscribe@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
On Mon, Jul 28, 2014 at 10:55 AM, Jared Bownds <jared....@gmail.com> wrote:
You nailed it! The code below works. However, users are still able to 'edit' their own comments once a ticket is resolved as signed.{{{
from trac.core import *
from trac.perm import IPermissionPolicy
from trac.ticket.model import Ticket
class ReadonlySignedTickets(Component):
implements(IPermissionPolicy)
def check_permission(self, action, username, resource, perm):
if resource is None or resource.realm != 'ticket' or \
resource.id is None or action == 'TICKET_VIEW' or \
if t['resolution'] == 'signed':
return False
}}}
Peter's plugin shown above work for me on 1.0-stable, and users aren't able to edit comments even if they have been granted TICKET_ADMIN. I used resolution //signed// rather than //Signed// since all of Trac's predefined resolutions are in lowercase.
Which Trac version are you running?In order to implement your other requirements, it sounds like you'll want to:* Enable ExtraPermissionsProvider[components]
tracopt.perm.config_perm_provider.extrapermissionsprovider = enabled* Add the signed permission:
[extra-permissions]
_perms = TICKET_SIGNED* Grant TICKET_SIGNED to the appropriate user.
* Modify your workflow to only allow users with TICKET_SIGNED to resolve a ticket as signed. This is where things seem to get a bit tricky. You may need to have a workflow state signed rather than using a resolution, but that might not work since you probably want tickets to end in the closed state. You might need to implement a workflow action to replace set_resolution, which does permission checking to decide who can resolve a ticket as signed ... or perhaps the permission checking can be done in the ReadonlySignedTickets policy as well. I'll have to give that more thought.
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
Okay, hopefully this is the last iteration!Using the code below as our example, for some reason users who are not TRAC_ADMIN are unable to comment or modify tickets, irrespective of resolution status.Also, I've included my permission policy configuration below.ReadonlySignedTickets.py{{{if t['resolution'] == 'Signed':from trac.core import *
from trac.perm import IPermissionPolicy
from trac.ticket.model import Ticket
class ReadonlySignedTickets(Component):
implements(IPermissionPolicy)
def check_permission(self, action, username, resource, perm):
if resource is None or resource.realm != 'ticket' or \
resource.id is None or action == 'TICKET_VIEW' or \
action == 'TRAC_ADMIN' or 'TRAC_ADMIN' in perm:
return None
t = Ticket(self.env, resource.id)
return False
}}}[trac]permission_policies = DefaultPermissionPolicy, ReadonlySignedTickets, LegacyAttachmentPolicy (this configuration locks any user but TRAC_ADMIN irrespective of resolution type)ORpermission_policies = ReadonlySignedTickets, DefaultPermissionPolicy, LegacyAttachmentPolicy (This configuration doesn't work according to the desired behavior, since I believe permissions are processed in order, one superseding another)
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
My present challenge with the latter permission policy configuration and ReadonlySignedTickets.py is that all users but TRAC_ADMIN are unable to comment on any ticket, irrespective of its status (new, assigned, open, closed as closed). In summary, it's simply not working as desired.
if t['resolution'] == 'Signed':
if t['resolution'] == 'Signed' and t['status'] == 'closed':
--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/1GNDHTObQKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.
Alright, permissions are now working properly. For some reason I omitted the last if statement qualifying the resolution type.Moving forward, I'm having a problem with the visual indication here. I can see in the trac log that signed.png is being loaded, however I'm not seeing the image displayed on a signed ticket. Keep in mind, I do however see the ticket body change color - signed.png is located in my environments htdocs folder.style.css{{{body.resolution_is_Signed {background: #f5deb3 url(signed.png);}}}}
On Mon, Jul 28, 2014 at 10:55 AM, Jared Bownds <jared....@gmail.com> wrote:
You nailed it! The code below works. However, users are still able to 'edit' their own comments once a ticket is resolved as signed.
{{{
from trac.core import *
from trac.perm import IPermissionPolicy
from trac.ticket.model import Ticket
class ReadonlySignedTickets(Component):
implements(IPermissionPolicy)
def check_permission(self, action, username, resource, perm):
if resource is None or resource.realm != 'ticket' or \
resource.id is None or action == 'TICKET_VIEW' or \
action == 'TRAC_ADMIN' or 'TRAC_ADMIN' in perm:
return None
t = Ticket(self.env, resource.id)
if t['resolution'] == 'signed':
return False
}}}
I want to apply this to all closed tickets (no special resolution) and I am not having much luck. I tried to change the line if t['resolution'] == 'fixed', if t['resolution'] == 'closed' but nothing happened. any idea how I can debug\fix this?Thanks,