Modify ↓
Opened 12 years ago
Closed 12 years ago
#10281 closed defect (fixed)
DISCUSSION_ATTACH perm needed to be able to view an attachment
Reported by: | sdegrande | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | DiscussionPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
I would suggest that DISCUSSION_VIEW should be enough to be granted to view the attachments of a topic.
Currently, DISCUSSION_ATTACH perm is needed, and as far as I understand, that perm is rather intended to grant the actual attachment of a file to a topic.
Here is a small patch to change the current behavior:
-
discussionplugin/0.11/tracdiscussion/api.py
diff -r ec2c58e517b9 discussionplugin/0.11/tracdiscussion/api.py
a b 155 155 156 156 def check_attachment_permission(self, action, username, resource, perm): 157 157 if resource.parent.realm == 'discussion': 158 if action in ['ATTACHMENT_VIEW', 'ATTACHMENT_CREATE', 159 'ATTACHMENT_DELETE']: 158 if action in ['ATTACHMENT_CREATE', 'ATTACHMENT_DELETE']: 160 159 return 'DISCUSSION_ATTACH' in perm(resource.parent) 160 elif action in ['ATTACHMENT_VIEW']: 161 return 'DISCUSSION_VIEW' in perm(resource.parent) 161 162 162 163 # IResourceManager methods.
Thanks for your great work !
Attachments (0)
Change History (2)
comment:1 Changed 12 years ago by
Owner: | changed from Radek Bartoň to Ryan J Ollos |
---|---|
Status: | new → assigned |
comment:2 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
Replying to sdegrande:
I agree,
DISCUSSION_ATTACH
should only be required for adding or deleting an attachment.DISCUSSION_VIEW
should be sufficient for viewing an attachment.