comparison roundup/mailgw.py @ 3876:29759dfcfbcf

Tell user where to register in mail about user being unknown... ...if tracker allows anonymous web access + user creation.
author Erik Forsberg <forsberg@users.sourceforge.net>
date Sat, 01 Sep 2007 16:14:21 +0000
parents f4e8dc583256
children 6b3919328381
comparison
equal deleted inserted replaced
3875:64a12bd91fc0 3876:29759dfcfbcf
71 set() method to add the message to the item's spool; in the second case we 71 set() method to add the message to the item's spool; in the second case we
72 are calling the create() method to create a new node). If an auditor raises 72 are calling the create() method to create a new node). If an auditor raises
73 an exception, the original message is bounced back to the sender with the 73 an exception, the original message is bounced back to the sender with the
74 explanatory message given in the exception. 74 explanatory message given in the exception.
75 75
76 $Id: mailgw.py,v 1.188 2007-05-12 16:14:54 forsberg Exp $ 76 $Id: mailgw.py,v 1.189 2007-09-01 16:14:21 forsberg Exp $
77 """ 77 """
78 __docformat__ = 'restructuredtext' 78 __docformat__ = 'restructuredtext'
79 79
80 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri 80 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
81 import time, random, sys, logging 81 import time, random, sys, logging
904 # make sure the author has permission to use the email interface 904 # make sure the author has permission to use the email interface
905 if not self.db.security.hasPermission('Email Access', author): 905 if not self.db.security.hasPermission('Email Access', author):
906 if author == anonid: 906 if author == anonid:
907 # we're anonymous and we need to be a registered user 907 # we're anonymous and we need to be a registered user
908 from_address = from_list[0][1] 908 from_address = from_list[0][1]
909 registration_info = ""
910 if self.db.security.hasPermission('Web Access', author) and \
911 self.db.security.hasPermission('Create', anonid, 'user'):
912 tracker_web = self.instance.config.TRACKER_WEB
913 registration_info = """ Please register at:
914
915 %(tracker_web)suser?template=register
916
917 ...before sending mail to the tracker.""" % locals()
918
909 raise Unauthorized, _(""" 919 raise Unauthorized, _("""
910 You are not a registered user. 920 You are not a registered user.%(registration_info)s
911 921
912 Unknown address: %(from_address)s 922 Unknown address: %(from_address)s
913 """) % locals() 923 """) % locals()
914 else: 924 else:
915 # we're registered and we're _still_ not allowed access 925 # we're registered and we're _still_ not allowed access

Roundup Issue Tracker: http://roundup-tracker.org/