diff options
Diffstat (limited to 'Bugs-Everywhere-Web/beweb')
-rw-r--r-- | Bugs-Everywhere-Web/beweb/app.cfg | 16 | ||||
-rw-r--r-- | Bugs-Everywhere-Web/beweb/controllers.py | 4 | ||||
-rw-r--r-- | Bugs-Everywhere-Web/beweb/model.py | 7 | ||||
-rw-r--r-- | Bugs-Everywhere-Web/beweb/templates/bugs.kid | 3 | ||||
-rw-r--r-- | Bugs-Everywhere-Web/beweb/templates/edit_bug.kid | 3 |
5 files changed, 22 insertions, 11 deletions
diff --git a/Bugs-Everywhere-Web/beweb/app.cfg b/Bugs-Everywhere-Web/beweb/app.cfg index 0035ffb..024fa8a 100644 --- a/Bugs-Everywhere-Web/beweb/app.cfg +++ b/Bugs-Everywhere-Web/beweb/app.cfg @@ -31,7 +31,7 @@ # -------------- # Enable Visit tracking -# visit.on=False +visit.on=True # Number of minutes a visit may be idle before it expires. # visit.timeout=20 @@ -57,29 +57,29 @@ # -------- # Switch to turn on or off the Identity management module -# identity.on=False +identity.on=True # [REQUIRED] URL to which CherryPy will internally redirect when an access # control check fails. If Identity management is turned on, a value for this # option must be specified. -# identity.failure_url=None +identity.failure_url="/login" # The IdentityProvider to use -- defaults to the SqlObjectIdentityProvider which # pulls User, Group, and Permission data out of your model database. -# identity.provider="sqlobject" +identity.provider="sqlobject" # The names of the fields on the login form containing the visitor's user ID # and password. In addition, the submit button is specified simply so its # existence may be stripped out prior to passing the form data to the target # controller. -# identity.form.user_name="user_name" -# identity.form.password="password" -# identity.form.submit="login" +identity.form.user_name="user_name" +identity.form.password="password" +identity.form.submit="login" # What sources should the identity provider consider when determining the # identity associated with a request? Comma separated list of identity sources. # Valid sources: form, visit, http_auth -# identity.source="form,http_auth,visit" +identity.source="form,http_auth,visit" # SqlObjectIdentityProvider diff --git a/Bugs-Everywhere-Web/beweb/controllers.py b/Bugs-Everywhere-Web/beweb/controllers.py index 9231030..4417a63 100644 --- a/Bugs-Everywhere-Web/beweb/controllers.py +++ b/Bugs-Everywhere-Web/beweb/controllers.py @@ -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)) diff --git a/Bugs-Everywhere-Web/beweb/model.py b/Bugs-Everywhere-Web/beweb/model.py index e20d1ce..6a603bb 100644 --- a/Bugs-Everywhere-Web/beweb/model.py +++ b/Bugs-Everywhere-Web/beweb/model.py @@ -1,10 +1,15 @@ 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.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() if + "fixbugs" in identity.current.permissions]) + # class YourDataClass(SQLObject): # pass diff --git a/Bugs-Everywhere-Web/beweb/templates/bugs.kid b/Bugs-Everywhere-Web/beweb/templates/bugs.kid index b83a593..3271537 100644 --- a/Bugs-Everywhere-Web/beweb/templates/bugs.kid +++ b/Bugs-Everywhere-Web/beweb/templates/bugs.kid @@ -2,7 +2,8 @@ <?python from libbe.cmdutil import unique_name from beweb.controllers import bug_url, project_url, bug_list_url -from beweb.config import people +from beweb.model import people_map +people = people_map() def row_class(bug, num): if not bug.active is True: return "closed" diff --git a/Bugs-Everywhere-Web/beweb/templates/edit_bug.kid b/Bugs-Everywhere-Web/beweb/templates/edit_bug.kid index c31d660..34fcb99 100644 --- a/Bugs-Everywhere-Web/beweb/templates/edit_bug.kid +++ b/Bugs-Everywhere-Web/beweb/templates/edit_bug.kid @@ -3,8 +3,9 @@ from libbe.bugdir import severity_levels, active_status, inactive_status, thread_comments from libbe.utility import time_to_str from beweb.controllers import bug_list_url, comment_url -from beweb.config import people from beweb.formatting import comment_body_xhtml, select_among +from beweb.model import people_map +people = people_map() ?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" py:extends="'master.kid'"> |