Mercurial > p > roundup > code
diff roundup/mailgw.py @ 467:103f521810f7
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
| author | Roche Compaan <rochecompaan@users.sourceforge.net> |
|---|---|
| date | Thu, 20 Dec 2001 15:43:01 +0000 |
| parents | 29f5ac8a0d2b |
| children | a1a44636bace |
line wrap: on
line diff
--- a/roundup/mailgw.py Thu Dec 20 06:13:24 2001 +0000 +++ b/roundup/mailgw.py Thu Dec 20 15:43:01 2001 +0000 @@ -73,7 +73,7 @@ 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 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 @@ 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 @@ # # 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 @@ # # $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. #
