From faef74ce4860646826278e12cb7026d0a1a6dbfd Mon Sep 17 00:00:00 2001 From: rochecompaan Date: Thu, 20 Dec 2001 15:43:01 +0000 Subject: [PATCH] Features added: . Multilink properties are now displayed as comma separated values in a textbox . The add user link is now only visible to the admin user . Modified the mail gateway to reject submissions from unknown addresses if ANONYMOUS_ACCESS is denied git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@479 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/cgi_client.py | 29 ++++++++++++++-- roundup/htmltemplate.py | 43 +++++++++++++++--------- roundup/mailgw.py | 36 ++++++++++++++++++-- roundup/roundupdb.py | 16 +++++++-- roundup/templates/classic/interfaces.py | 6 +++- roundup/templates/extended/interfaces.py | 6 +++- 6 files changed, 110 insertions(+), 26 deletions(-) diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index c8e1fef..5a78b17 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: cgi_client.py,v 1.85 2001-12-20 06:13:24 rochecompaan Exp $ +# $Id: cgi_client.py,v 1.86 2001-12-20 15:43:01 rochecompaan Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -120,10 +120,16 @@ class Client: else: user_info = _('Login') if self.user is not None: - add_links = _(''' + if self.user == 'admin': + add_links = _(''' | Add Issue, User +''') + else: + add_links = _(''' +| Add +Issue ''') else: add_links = '' @@ -1059,11 +1065,18 @@ class ExtendedClient(Client): else: user_info = _('Login') if self.user is not None: - add_links = _(''' + if self.user == 'admin': + add_links = _(''' | Add Issue, Support, User +''') + else: + add_links = _(''' +| Add +Issue, +Support, ''') else: add_links = '' @@ -1163,6 +1176,16 @@ def parsePropsFromForm(db, cl, form, nodeid=0): # # $Log: not supported by cvs2svn $ +# Revision 1.85 2001/12/20 06:13:24 rochecompaan +# Bugs fixed: +# . Exception handling in hyperdb for strings-that-look-like numbers got +# lost somewhere +# . Internet Explorer submits full path for filename - we now strip away +# the path +# Features added: +# . Link and multilink properties are now displayed sorted in the cgi +# interface +# # Revision 1.84 2001/12/18 15:30:30 rochecompaan # Fixed bugs: # . Fixed file creation and retrieval in same transaction in anydbm diff --git a/roundup/htmltemplate.py b/roundup/htmltemplate.py index ea2981f..f0d12d4 100644 --- a/roundup/htmltemplate.py +++ b/roundup/htmltemplate.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: htmltemplate.py,v 1.48 2001-12-20 06:13:24 rochecompaan Exp $ +# $Id: htmltemplate.py,v 1.49 2001-12-20 15:43:01 rochecompaan Exp $ __doc__ = """ Template engine. @@ -178,23 +178,24 @@ class TemplateFunctions: elif isinstance(propclass, hyperdb.Multilink): list = linkcl.list() list.sort(sortfunc) - height = height or min(len(list), 7) - l = ['') - s = '\n'.join(l) + input_value.append(lab) + if size is None: + size = '10' + l.insert(0,''%(property, + size, ','.join(input_value))) + s = "
\n".join(l) else: s = 'Plain: bad propclass "%s"'%propclass return s @@ -884,6 +885,16 @@ class NewItemTemplate(TemplateFunctions): # # $Log: not supported by cvs2svn $ +# Revision 1.48 2001/12/20 06:13:24 rochecompaan +# Bugs fixed: +# . Exception handling in hyperdb for strings-that-look-like numbers got +# lost somewhere +# . Internet Explorer submits full path for filename - we now strip away +# the path +# Features added: +# . Link and multilink properties are now displayed sorted in the cgi +# interface +# # Revision 1.47 2001/11/26 22:55:56 richard # Feature: # . Added INSTANCE_NAME to configuration - used in web and email to identify diff --git a/roundup/mailgw.py b/roundup/mailgw.py index f533c75..9b3c141 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -73,7 +73,7 @@ are calling the create() method to create a new node). If an auditor raises an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.44 2001-12-18 15:30:34 rochecompaan Exp $ +$Id: mailgw.py,v 1.45 2001-12-20 15:43:01 rochecompaan Exp $ ''' @@ -87,6 +87,9 @@ class MailGWError(ValueError): class MailUsageError(ValueError): pass +class UnAuthorized(Exception): + """ Access denied """ + class Message(mimetools.Message): ''' subclass mimetools.Message so we can retrieve the parts of the message... @@ -148,6 +151,12 @@ class MailGW: m.append('\n\nMail Gateway Help\n=================') m.append(fulldoc) m = self.bounce_message(message, sendto, m) + except UnAuthorized, value: + # just inform the user that he is not authorized + sendto = [sendto[0][1]] + m = [''] + m.append(str(value)) + m = self.bounce_message(message, sendto, m) except: # bounce the message back to the sender with the error message sendto = [sendto[0][1]] @@ -366,7 +375,21 @@ Subject was: "%s" # # handle the users # - author = self.db.uidFromAddress(message.getaddrlist('from')[0]) + + # Don't create users if ANONYMOUS_ACCESS is denied + if self.ANONYMOUS_ACCESS == 'deny': + create = 0 + else: + create = 1 + author = self.db.uidFromAddress(message.getaddrlist('from')[0], + create=create) + if not author: + raise UnAuthorized, ''' +You are not a registered user. + +Unknown address: %s +'''%message.getaddrlist('from')[0][1] + # reopen the database as the author username = self.db.user.get(author, 'username') self.db = self.instance.open(username) @@ -638,6 +661,15 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'), # # $Log: not supported by cvs2svn $ +# Revision 1.44 2001/12/18 15:30:34 rochecompaan +# Fixed bugs: +# . Fixed file creation and retrieval in same transaction in anydbm +# backend +# . Cgi interface now renders new issue after issue creation +# . Could not set issue status to resolved through cgi interface +# . Mail gateway was changing status back to 'chatting' if status was +# omitted as an argument +# # Revision 1.43 2001/12/15 19:39:01 rochecompaan # Oops. # diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py index 50cd90c..603e608 100644 --- a/roundup/roundupdb.py +++ b/roundup/roundupdb.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundupdb.py,v 1.34 2001-12-17 03:52:48 richard Exp $ +# $Id: roundupdb.py,v 1.35 2001-12-20 15:43:01 rochecompaan Exp $ __doc__ = """ Extending hyperdb with types specific to issue-tracking. @@ -71,8 +71,11 @@ class Database: users = self.user.stringFind(username=address) # couldn't match address or username, so create a new user - return self.user.create(username=address, address=address, - realname=realname) + if create: + return self.user.create(username=address, address=address, + realname=realname) + else: + return 0 _marker = [] # XXX: added the 'creator' faked attribute @@ -492,6 +495,13 @@ class IssueClass(Class): # # $Log: not supported by cvs2svn $ +# Revision 1.34 2001/12/17 03:52:48 richard +# Implemented file store rollback. As a bonus, the hyperdb is now capable of +# storing more than one file per node - if a property name is supplied, +# the file is called designator.property. +# I decided not to migrate the existing files stored over to the new naming +# scheme - the FileClass just doesn't specify the property name. +# # Revision 1.33 2001/12/16 10:53:37 richard # take a copy of the node dict so that the subsequent set # operation doesn't modify the oldvalues structure diff --git a/roundup/templates/classic/interfaces.py b/roundup/templates/classic/interfaces.py index 72c2cbb..ac2acc7 100644 --- a/roundup/templates/classic/interfaces.py +++ b/roundup/templates/classic/interfaces.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: interfaces.py,v 1.9 2001-11-26 23:00:53 richard Exp $ +# $Id: interfaces.py,v 1.10 2001-12-20 15:43:01 rochecompaan Exp $ import instance_config from roundup import cgi_client, mailgw @@ -38,9 +38,13 @@ class MailGW(mailgw.MailGW): ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL ADMIN_EMAIL = instance_config.ADMIN_EMAIL MAILHOST = instance_config.MAILHOST + ANONYMOUS_ACCESS = instance_config.ANONYMOUS_ACCESS # # $Log: not supported by cvs2svn $ +# Revision 1.9 2001/11/26 23:00:53 richard +# This config stuff is getting to be a real mess... +# # Revision 1.8 2001/10/22 03:25:01 richard # Added configuration for: # . anonymous user access and registration (deny/allow) diff --git a/roundup/templates/extended/interfaces.py b/roundup/templates/extended/interfaces.py index bfe9269..8f84e66 100644 --- a/roundup/templates/extended/interfaces.py +++ b/roundup/templates/extended/interfaces.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: interfaces.py,v 1.13 2001-11-26 23:00:53 richard Exp $ +# $Id: interfaces.py,v 1.14 2001-12-20 15:43:01 rochecompaan Exp $ import instance_config from roundup import cgi_client, mailgw @@ -38,9 +38,13 @@ class MailGW(mailgw.MailGW): ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL ADMIN_EMAIL = instance_config.ADMIN_EMAIL MAILHOST = instance_config.MAILHOST + ANONYMOUS_ACCESS = instance_config.ANONYMOUS_ACCESS # # $Log: not supported by cvs2svn $ +# Revision 1.13 2001/11/26 23:00:53 richard +# This config stuff is getting to be a real mess... +# # Revision 1.12 2001/10/22 03:25:01 richard # Added configuration for: # . anonymous user access and registration (deny/allow) -- 2.30.2