Skip to content

Commit d707f9b

Browse files
author
Richard Jones
committed
fixed the mailgw so that anonymous users may still access it
1 parent 00694ae commit d707f9b

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ are given with the most recent entry first.
4343
- merge Zope Collector #580 fix from ZPT CVS trunk
4444
- added "crypt" password encoding and ability to set password with
4545
already encrypted password through roundup-admin
46+
- fixed the mailgw so that anonymous users may still access it
4647

4748

4849
2002-09-13 0.5.0 beta2

doc/customizing.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.47 $
5+
:Version: $Revision: 1.48 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -1483,6 +1483,27 @@ When adding a new Permission, you will need to:
14831483
4. add it to the appropriate xxxPermission methods on in your tracker
14841484
interfaces module
14851485

1486+
Example Scenarios
1487+
-----------------
1488+
1489+
**automatic registration of users in the e-mail gateway**
1490+
By giving the "anonymous" user the "Email Registration" Role, any
1491+
unidentified user will automatically be registered with the tracker (with
1492+
no password, so they won't be able to log in through the web until an admin
1493+
sets them a password). Note: this is the default behaviour in the tracker
1494+
templates that ship with Roundup.
1495+
1496+
**anonymous access through the e-mail gateway**
1497+
Give the "anonymous" user the "Email Access" and ("Edit", "issue") Roles
1498+
but not giving them the "Email Registration" Role. This means that when an
1499+
unknown user sends email into the tracker, they're automatically logged in
1500+
as "anonymous". Since they don't have the "Email Registration" Role, they
1501+
won't be automatically registered, but since "anonymous" has permission
1502+
to use the gateway, they'll still be able to submit issues. Note that the
1503+
Sender information - their email address - will not be available - they're
1504+
*anonymous*.
1505+
1506+
XXX more examples needed
14861507

14871508

14881509
Examples

roundup/mailgw.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373
an exception, the original message is bounced back to the sender with the
7474
explanatory message given in the exception.
7575
76-
$Id: mailgw.py,v 1.92 2002-09-26 03:03:18 richard Exp $
76+
$Id: mailgw.py,v 1.93 2002-09-26 22:15:54 richard Exp $
7777
'''
7878

7979
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
@@ -483,17 +483,24 @@ def handle_message(self, message):
483483
author = uidFromAddress(self.db, message.getaddrlist('from')[0],
484484
create=create)
485485

486-
# no author? means we're not author
486+
# if we're not recognised, and we don't get added as a user, then we
487+
# must be anonymous
487488
if not author:
488-
raise Unauthorized, '''
489+
author = anonid
490+
491+
# make sure the author has permission to use the email interface
492+
if not self.db.security.hasPermission('Email Access', author):
493+
if author == anonid:
494+
# we're anonymous and we need to be a registered user
495+
raise Unauthorized, '''
489496
You are not a registered user.
490497
491498
Unknown address: %s
492499
'''%message.getaddrlist('from')[0][1]
493-
494-
# make sure the author has permission to use the email interface
495-
if not self.db.security.hasPermission('Email Access', author):
496-
raise Unauthorized, 'You are not permitted to access this tracker.'
500+
else:
501+
# we're registered and we're _still_ not allowed access
502+
raise Unauthorized, 'You are not permitted to access '\
503+
'this tracker.'
497504

498505
# make sure they're allowed to edit this class of information
499506
if not self.db.security.hasPermission('Edit', author, classname):

0 commit comments

Comments
 (0)