Used identity for new comments and bugs
authorAaron Bentley <abentley@panoramicfeedback.com>
Tue, 11 Apr 2006 22:32:26 +0000 (18:32 -0400)
committerAaron Bentley <abentley@panoramicfeedback.com>
Tue, 11 Apr 2006 22:32:26 +0000 (18:32 -0400)
Bugs-Everywhere-Web/beweb/controllers.py
Bugs-Everywhere-Web/beweb/model.py

index 9231030e6728133751d71b704b34f04887175ba5..4417a63a17d6aa96a9d2bcac4c938eba990073ac 100644 (file)
@@ -23,6 +23,7 @@ class Comment(PrestHandler):
         bug_tree = project_tree(comment_data['project'])
         bug = bug_tree.get_bug(comment_data['bug'])
         comment = new_comment(bug, "")
+        comment.From = identity.current.user.userId
         comment.content_type = "text/restructured"
         comment.save()
         raise cherrypy.HTTPRedirect(comment_url(comment=comment.uuid, 
@@ -33,6 +34,7 @@ class Comment(PrestHandler):
         bug_tree = project_tree(comment_data['project'])
         bug = bug_tree.get_bug(comment_data['bug'])
         reply_comment = new_comment(bug, "")
+        reply_comment.From = identity.current.user.userId
         reply_comment.in_reply_to = comment.uuid
         reply_comment.save()
         reply_data = dict(comment_data)
@@ -92,9 +94,11 @@ class Bug(PrestHandler):
                 "search"          : search,
                }
 
+    @identity.require( identity.has_permission("editbugs"))
     @provide_action("action", "New bug")
     def new_bug(self, bug_data, bug, **kwargs):
         bug = new_bug(project_tree(bug_data['project']))
+        bug.creator = identity.current.user.userId
         bug.save()
         raise cherrypy.HTTPRedirect(bug_url(bug_data['project'], bug.uuid))
 
index 2bda2997f7b09528b949609dc60bb2c982aba3d4..6a603bb510a4b57123ea0c6bc040807e7c482719 100644 (file)
@@ -2,12 +2,14 @@ from sqlobject import *
 from turbogears.database import PackageHub
 # Uncomment the following line if you wish to use Identity and SO_Provider
 from turbogears.identity.soprovider import TG_User, TG_Group, TG_Permission
+from turbogears import identity
 
 hub = PackageHub("beweb")
 __connection__ = hub
 
 def people_map():
-    return dict([(u.userId, u.displayName) for u in TG_User.select()])
+    return dict([(u.userId, u.displayName) for u in TG_User.select() if 
+                "fixbugs" in identity.current.permissions])
 
 # class YourDataClass(SQLObject):
 #     pass