[Python-checkins] r56591 - in tracker/instances/python-dev: html/file.item.html html/issue.item.html html/msg.item.html schema.py

erik.forsberg python-checkins at python.org
Fri Jul 27 22:29:30 CEST 2007


Author: erik.forsberg
Date: Fri Jul 27 22:29:30 2007
New Revision: 56591

Modified:
   tracker/instances/python-dev/html/file.item.html
   tracker/instances/python-dev/html/issue.item.html
   tracker/instances/python-dev/html/msg.item.html
   tracker/instances/python-dev/schema.py
Log:
Merged svn+ssh://svn.python.org/tracker/instances/python-dev-spambayes-integration r56590 down to python-dev

Modified: tracker/instances/python-dev/html/file.item.html
==============================================================================
--- tracker/instances/python-dev/html/file.item.html	(original)
+++ tracker/instances/python-dev/html/file.item.html	Fri Jul 27 22:29:30 2007
@@ -56,11 +56,11 @@
 <p tal:condition="python:utils.sb_is_spam(context)" class="error-message">
    File has been classified as spam.</p>
 
-<a tal:condition="python:context.id and utils.sb_is_view_ok(context)"
+<a tal:condition="python:context.id and context.content.is_view_ok()"
  tal:attributes="href string:file${context/id}/${context/name}"
  i18n:translate="">download</a>
 
-<p tal:condition="python:context.id and not utils.sb_is_view_ok(context)">
+<p tal:condition="python:context.id and not context.content.is_view_ok()">
    Files classified as spam are not available for download by
    unathorized users. If you think the file has been misclassified,
    please login and click on the button for reclassification.

Modified: tracker/instances/python-dev/html/issue.item.html
==============================================================================
--- tracker/instances/python-dev/html/issue.item.html	(original)
+++ tracker/instances/python-dev/html/issue.item.html	Fri Jul 27 22:29:30 2007
@@ -247,7 +247,7 @@
        tal:condition="python:utils.sb_is_spam(msg)">
        Message has been classified as spam.
     </p>
-    <pre tal:condition="python:utils.sb_is_view_ok(msg)"
+    <pre tal:condition="python:msg.content.is_view_ok()"
          tal:content="structure msg/content/hyperlinked">content</pre>
    </td>
   </tr>

Modified: tracker/instances/python-dev/html/msg.item.html
==============================================================================
--- tracker/instances/python-dev/html/msg.item.html	(original)
+++ tracker/instances/python-dev/html/msg.item.html	Fri Jul 27 22:29:30 2007
@@ -67,7 +67,8 @@
 
  <tr>
    <th class="header" i18n:translate="">Content</th>
-   <th class="header" tal:condition="python:utils.sb_may_classify(context)">
+   <th class="header"
+   tal:condition="python:request.user.hasPermission('SB: May Classify')">
      <form method="POST" onSubmit="return submit_once()"
        enctype="multipart/form-data"
        tal:attributes="action context/designator">
@@ -82,10 +83,11 @@
 
  <tr>
   <td class="content" colspan=2
-      tal:condition="python:utils.sb_is_view_ok(context)"><pre
+      tal:condition="python:context.content.is_view_ok()">
+      <pre
       tal:content="structure context/content/hyperlinked"></pre></td>
   <td class="content" colspan=2
-      tal:condition="python:not utils.sb_is_view_ok(context)">
+      tal:condition="python:not context.content.is_view_ok()">
             Message has been classified as spam and is therefore not
       available to unathorized users. If you think this is
       incorrect, please login and report the message as being

Modified: tracker/instances/python-dev/schema.py
==============================================================================
--- tracker/instances/python-dev/schema.py	(original)
+++ tracker/instances/python-dev/schema.py	Fri Jul 27 22:29:30 2007
@@ -134,6 +134,9 @@
 db.security.addRole(name='Developer', description='A developer')
 db.security.addRole(name='Coordinator', description='A coordinator')
 
+sb_may_classify  = db.security.addPermission(name="SB: May Classify")
+sb_may_report_misclassified = db.security.addPermission(name="SB: May Report Misclassified")
+
 #
 # REGULAR USERS
 #
@@ -166,15 +169,13 @@
             return True
 
         if score > cutoff_score:
-            roles = set(db.user.get(userid, "roles").lower().split(","))
-            allowed = set(db.config.detectors['SPAMBAYES_MAY_VIEW_SPAM'].lower().split(","))
-            return bool(roles.intersection(allowed))
+            return False
 
         return True
 
 for cl in ('file', 'msg'):
     p = db.security.addPermission(name='View', klass=cl,
-                                  description="allowed to see metadata of file object regardless of spam status",
+                                  description="allowed to see metadata object regardless of spam status",
                                   properties=('creation', 'activity',
                                               'creator', 'actor',
                                               'name', 'spambayes_score',
@@ -185,22 +186,25 @@
                                               ))
 
     db.security.addPermissionToRole('Anonymous', p)
-    db.security.addPermissionToRole('User', p)    
+    db.security.addPermissionToRole('User', p)
+
+    db.security.addPermissionToRole('User', 'Create', cl)
+
+    p = db.security.addPermission(name='View', klass=cl,
+                                  description="Allowed to see content of object regardless of spam status",
+                                  properties = ('content', 'summary'))
     
+    db.security.addPermissionToRole('User', p)        
     
     spamcheck = db.security.addPermission(name='View', klass=cl,
-                                          description="allowed to see metadata of file object regardless of spam status",
+                                          description="allowed to see content if not spam",
                                           properties=('content', 'summary'),
                                           check=may_view_spam(cl))
-    
-    db.security.addPermissionToRole('User', spamcheck)    
+
     db.security.addPermissionToRole('Anonymous', spamcheck)
 
     
 
-for cl in 'file', 'msg':
-    db.security.addPermissionToRole('User', 'Create', cl)
-
 p = db.security.addPermission(name='Create', klass='issue',
                               properties=('title', 'type',
                                           'components', 'versions',
@@ -217,6 +221,9 @@
                               description='User can report and discuss issues')
 db.security.addPermissionToRole('User', p)
 
+db.security.addPermissionToRole('User', 'SB: May Report Misclassified')
+
+
 
 ##########################
 # Developer permissions
@@ -240,6 +247,8 @@
     db.security.addPermissionToRole('Coordinator', 'Edit', cl)
     db.security.addPermissionToRole('Coordinator', 'Create', cl)
 
+db.security.addPermissionToRole('Coordinator', 'SB: May Classify')
+
 # May users view other user information? Comment these lines out
 # if you don't want them to
 db.security.addPermissionToRole('User', 'View', 'user')
@@ -314,7 +323,10 @@
 db.security.addPermissionToRole('Anonymous', 'Create', 'user')
 
 # Allow anonymous users access to view issues (and the related, linked
-# information)
+# information).
+# Note permissions settings for file and msg above (due to spambayes
+# integration).
+
 for cl in 'issue', 'severity', 'status', 'resolution':
     db.security.addPermissionToRole('Anonymous', 'View', cl)
 


More information about the Python-checkins mailing list