[Zope3-checkins] CVS: zopeproducts/bugtracker/browser - bug.py:1.2 bug_overview.pt:1.2 configure.zcml:1.2 dependencies.pt:1.2
Stephan Richter
srichter@cosmos.phy.tufts.edu
Thu, 24 Jul 2003 17:39:16 -0400
Update of /cvs-repository/zopeproducts/bugtracker/browser
In directory cvs.zope.org:/tmp/cvs-serv2895/browser
Modified Files:
bug.py bug_overview.pt configure.zcml dependencies.pt
Log Message:
Implemented security features. It seems all to work well based on my tests.
=== zopeproducts/bugtracker/browser/bug.py 1.1 => 1.2 ===
--- zopeproducts/bugtracker/browser/bug.py:1.1 Thu Jul 24 14:08:10 2003
+++ zopeproducts/bugtracker/browser/bug.py Thu Jul 24 17:39:10 2003
@@ -26,6 +26,8 @@
from zope.app.browser.form.widget import TextWidget
from zope.app.context import ContextWrapper
from zope.app.form.widget import CustomWidget
+from zope.app.security.grants.principalrole import principalRoleManager
+from zope.app.security.settings import Allow
from zope.app.services.servicenames import Authentication
from zope.app.traversing import getParent, getName
from zope.app.interfaces.dublincore import IZopeDublinCore
@@ -239,6 +241,13 @@
'open_perc': '%.2f%%' %(open*100.0/all_num),
}
return stats
+
+ def canChangeDependencies(self):
+ pid = self.request.user.getId()
+ roles = principalRoleManager.getRolesForPrincipal(pid)
+ roles = filter(lambda r: r[1] == Allow, roles)
+ roles = map(lambda r: r[0], roles)
+ return 'bugtracker.Editor' in roles
legend = ViewPageTemplateFile('legend.pt')
=== zopeproducts/bugtracker/browser/bug_overview.pt 1.1 => 1.2 ===
--- zopeproducts/bugtracker/browser/bug_overview.pt:1.1 Thu Jul 24 14:08:10 2003
+++ zopeproducts/bugtracker/browser/bug_overview.pt Thu Jul 24 17:39:10 2003
@@ -40,7 +40,7 @@
<div class="label">Owners:</div>
<div class="field">
<tal:block repeat="owner view/owners">
- <d tal:content="owner/principal/getTitle" tal:omit-tag="" />
+ <d tal:content="owner/principal/title" tal:omit-tag="" />
<d tal:condition="not:repeat/owner/end" tal:omit-tag="">,</d>
</tal:block>
</div>
=== zopeproducts/bugtracker/browser/configure.zcml 1.1 => 1.2 ===
--- zopeproducts/bugtracker/browser/configure.zcml:1.1 Thu Jul 24 14:08:10 2003
+++ zopeproducts/bugtracker/browser/configure.zcml Thu Jul 24 17:39:10 2003
@@ -26,7 +26,7 @@
for="zopeproducts.bugtracker.interfaces.IBugTracker"
name="+"
class=".tracker.BugTrackerAdding"
- permission="zope.View"
+ permission="bugtracker.AddBug"
allowed_attributes="addingInfo"
menu="zmi_actions"
title="Add">
@@ -38,7 +38,7 @@
for="zopeproducts.bugtracker.interfaces.IBug"
name="+"
class=".bug.BugAdding"
- permission="zope.View"
+ permission="bugtracker.ViewBug"
allowed_attributes="addingInfo"
menu="zmi_actions"
title="Add">
@@ -54,7 +54,7 @@
name="AddBugTracker"
schema="zopeproducts.bugtracker.interfaces.IBugTracker"
content_factory="zopeproducts.bugtracker.tracker.BugTracker"
- permission="zope.View"
+ permission="zope.ManageContent"
class=".tracker.AddBugTracker"
template="tracker_add.pt"
menu="add_content" title="Bug Tracker"/>
@@ -62,7 +62,7 @@
<browser:pages
for="zopeproducts.bugtracker.interfaces.IBugTracker"
class=".tracker.Overview"
- permission="zope.View">
+ permission="bugtracker.ViewBugTracker">
<browser:page name="overview.html" template="tracker_overview.pt"
menu="zmi_views" title="Overview" />
<browser:page name="updateOverviewSettings.html"
@@ -72,7 +72,7 @@
<browser:pages
for="zopeproducts.bugtracker.interfaces.IBugTracker"
class=".tracker.Settings"
- permission="zope.View">
+ permission="bugtracker.ManageBugTracker">
<browser:page name="settings.html" template="tracker_settings.pt"
menu="zmi_views" title="Settings" />
<browser:page name="addValue.html" attribute="addValue" />
@@ -82,7 +82,7 @@
<browser:pages
for="zopeproducts.bugtracker.interfaces.IBugTracker"
class=".mail.MailSubscriptions"
- permission="zope.View">
+ permission="bugtracker.ManageBugTracker">
<browser:page name="subscriptions.html" template="subscriptions.pt"
menu="zmi_views" title="Subscriptions" />
<browser:page name="changeSubscriptions.html" attribute="change" />
@@ -93,7 +93,6 @@
for="zopeproducts.bugtracker.interfaces.IBugTracker"/>
-
<!-- Bug configuration -->
<browser:addform
@@ -101,7 +100,7 @@
name="AddBug"
schema="zopeproducts.bugtracker.interfaces.IBug"
content_factory="zopeproducts.bugtracker.bug.Bug"
- permission="zope.View"
+ permission="bugtracker.AddBug"
fields="title description type owners status priority release"
class=".bug.AddBug"
menu="add_bugtracker"
@@ -112,7 +111,7 @@
for="zopeproducts.bugtracker.interfaces.IBug"
label="Change Bug"
name="edit.html"
- permission="zope.View"
+ permission="bugtracker.EditBug"
fields="title description type owners status priority release"
template="bug_edit.pt"
class=".bug.EditBug"
@@ -121,7 +120,7 @@
<browser:pages
for="zopeproducts.bugtracker.interfaces.IBug"
class=".bug.Overview"
- permission="zope.View">
+ permission="bugtracker.ViewBug">
<browser:page name="overview.html" template="bug_overview.pt"
menu="zmi_views" title="Overview" />
</browser:pages>
@@ -129,7 +128,7 @@
<browser:pages
for="zopeproducts.bugtracker.interfaces.IBug"
class=".bug.Dependencies"
- permission="zope.View">
+ permission="bugtracker.ViewBug">
<browser:page name="dependencies.html" template="dependencies.pt"
menu="zmi_views" title="Dependencies" />
<browser:page name="setDependencies.html" attribute="setDependencies" />
@@ -138,7 +137,7 @@
<browser:pages
for="zopeproducts.bugtracker.interfaces.IBug"
class=".mail.MailSubscriptions"
- permission="zope.View">
+ permission="bugtracker.EditBug">
<browser:page name="subscriptions.html" template="subscriptions.pt"
menu="zmi_views" title="Subscriptions" />
<browser:page name="changeSubscriptions.html" attribute="change" />
@@ -170,7 +169,7 @@
name="AddBugComment"
schema="zopeproducts.bugtracker.interfaces.IComment"
content_factory="zopeproducts.bugtracker.comment.Comment"
- permission="zope.View"
+ permission="bugtracker.AddComment"
menu="add_bug" title="Comment"/>
<browser:editform
@@ -178,7 +177,7 @@
for="zopeproducts.bugtracker.interfaces.IComment"
label="Change Comment"
name="edit.html"
- permission="zope.View"
+ permission="bugtracker.ManageBugTracker"
menu="zmi_views" title="Edit" />
<browser:defaultView
@@ -192,7 +191,7 @@
name="UploadFile"
schema="zope.app.interfaces.content.file.IFile"
content_factory="zope.app.content.file.File"
- permission="zope.View"
+ permission="bugtracker.AddAttachment"
fields="data"
class=".attachments.FileUpload"
menu="add_bug" title="File Attachment"/>
@@ -202,10 +201,9 @@
name="UploadImage"
schema="zope.app.interfaces.content.image.IImage"
content_factory="zope.app.content.image.Image"
- permission="zope.View"
+ permission="bugtracker.AddAttachment"
fields="data"
class=".attachments.FileUpload"
menu="add_bug" title="Image Attachment"/>
-
</zopeConfigure>
=== zopeproducts/bugtracker/browser/dependencies.pt 1.1 => 1.2 ===
--- zopeproducts/bugtracker/browser/dependencies.pt:1.1 Thu Jul 24 14:08:10 2003
+++ zopeproducts/bugtracker/browser/dependencies.pt Thu Jul 24 17:39:10 2003
@@ -11,7 +11,8 @@
<div metal:fill-slot="body">
- <form action="setDependencies.html" method="post">
+ <form action="setDependencies.html" method="post"
+ tal:condition="view/canChangeDependencies">
<div id="explanation">
In the selection box below you can select the bugs that have to be
@@ -36,7 +37,8 @@
<option
tal:content="string: ${bug/title} (${bug/name})"
tal:attributes="value bug/name"
- tal:condition="python: bug['name'] not in view.dependencies()">
+ tal:condition="
+ python: bug['name'] not in view.dependencies()">
Bug1
</option>
</div>