Skip to content

Commit 6c47476

Browse files
author
Richard Jones
committed
Email fixes:
- fix checking of "Email Access" for Anonymous email registration [SF#177057] - disable "Email Access" for Anonymous by default to stop spam regsitering users on public trackers - doc fixes / additions too
1 parent 3e8f4cb commit 6c47476

File tree

5 files changed

+66
-52
lines changed

5 files changed

+66
-52
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Fixed:
1717
- web forms don't create new items if no item properties are set from UI
1818
- item creation failed if multilink fields had invalid entries (sf bug 1177602)
1919
- fix bdist_rpm (sf bug 1164328)
20+
- fix checking of "Email Access" for Anonymous email registration (sf bug
21+
1177057)
22+
- disable "Email Access" for Anonymous by default to stop spam regsitering
23+
users on public trackers
2024

2125

2226
2005-03-03 0.8.2

doc/customizing.txt

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

5-
:Version: $Revision: 1.176 $
5+
:Version: $Revision: 1.177 $
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
@@ -18,7 +18,7 @@ Before you get too far, it's probably worth having a quick read of the Roundup
1818

1919
Customisation of Roundup can take one of six forms:
2020

21-
1. `tracker configuration`_ file changes
21+
1. `tracker configuration`_ changes
2222
2. database, or `tracker schema`_ changes
2323
3. "definition" class `database content`_ changes
2424
4. behavioural changes, through detectors_
@@ -58,6 +58,12 @@ Tracker Configuration
5858
The ``config.ini`` located in your tracker home contains the basic
5959
configuration for the web and e-mail components of roundup's interfaces.
6060

61+
Changes to the data captured by your tracker is controlled by the `tracker
62+
schema`_. Some configuration is also performed using permissions - see the
63+
`security / access controls`_ section. For example, to allow users to
64+
automatically register through the email interface, you must grant the
65+
"Anonymous" Role the "Email Access" Permission.
66+
6167
The following is taken from the `Python Library Reference`__ (May 20, 2004)
6268
section "ConfigParser -- Configuration file parser":
6369

@@ -79,11 +85,6 @@ section "ConfigParser -- Configuration file parser":
7985

8086
__ http://docs.python.org/lib/module-ConfigParser.html
8187

82-
Configuration variables may be referred to in lower or upper case. In code,
83-
variables not in the "main" section are referred to using their section and
84-
name, so "domain" in the section "mail" becomes MAIL_DOMAIN. The
85-
configuration variables available are:
86-
8788
Section **main**
8889
database -- ``db``
8990
Database directory path. The path may be either absolute or relative
@@ -282,6 +283,11 @@ Section **nosy**
282283
You may generate a new default config file using the ``roundup-admin
283284
genconfig`` command.
284285

286+
Configuration variables may be referred to in lower or upper case. In code,
287+
variables not in the "main" section are referred to using their section and
288+
name, so "domain" in the section "mail" becomes MAIL_DOMAIN. The
289+
configuration variables available are:
290+
285291

286292
Tracker Schema
287293
==============
@@ -740,22 +746,28 @@ A set of Permissions is built into the security module by default:
740746
- Edit (everything)
741747
- View (everything)
742748

743-
Every Class you define in your tracker's schema also gets an Create, Edit
744-
and View Permission of its own.
745-
746-
The default interfaces define:
747-
748-
- Web Registration
749-
- Web Access
750-
- Web Roles
751-
- Email Registration
752-
- Email Access
749+
These are assigned to the "Admin" Role by default, and allow a user to do
750+
anything. Every Class you define in your `tracker schema`_ also gets an
751+
Create, Edit and View Permission of its own. The web and email interfaces
752+
also define:
753+
754+
*Email Access*
755+
If defined, the user may use the email interface. Used by default to deny
756+
Anonymous users access to the email interface. When granted to the
757+
Anonymous user, they will be automatically registered by the email
758+
interface (see also the ``new_email_user_roles`` configuration option).
759+
*Web Access*
760+
If defined, the user may use the web interface. All users are able to see
761+
the login form, regardless of this setting (thus enabling logging in).
762+
*Web Roles*
763+
Controls user access to editing the "roles" property of the "user" class.
764+
TODO: deprecate in favour of a property-based control.
753765

754766
These are hooked into the default Roles:
755767

756768
- Admin (Create, Edit, View and everything; Web Roles)
757769
- User (Web Access; Email Access)
758-
- Anonymous (Web Registration; Email Registration)
770+
- Anonymous (Web Access)
759771

760772
And finally, the "admin" user gets the "Admin" Role, and the "anonymous"
761773
user gets "Anonymous" assigned when the tracker is installed.
@@ -765,10 +777,11 @@ For the "User" Role, the "classic" tracker defines:
765777
- Create, Edit and View issue, file, msg, query, keyword
766778
- View priority, status
767779
- View user
768-
- Edit their own record
780+
- Edit their own user record
769781

770782
And the "Anonymous" Role is defined as:
771783

784+
- Web interface access
772785
- Create user (for registration)
773786
- View issue, file, msg, query, keyword, priority, status
774787

@@ -784,37 +797,31 @@ Put together, these settings appear in the tracker's ``schema.py`` file::
784797
# REGULAR USERS
785798
#
786799
# Give the regular users access to the web and email interface
787-
p = db.security.getPermission('Web Access')
788-
db.security.addPermissionToRole('User', p)
789-
p = db.security.getPermission('Email Access')
790-
db.security.addPermissionToRole('User', p)
800+
db.security.addPermissionToRole('User', 'Web Access')
801+
db.security.addPermissionToRole('User', 'Email Access')
791802

792803
# Assign the access and edit Permissions for issue, file and message
793804
# to regular users now
794805
for cl in 'issue', 'file', 'msg', 'query', 'keyword':
795-
p = db.security.getPermission('View', cl)
796-
db.security.addPermissionToRole('User', p)
797-
p = db.security.getPermission('Edit', cl)
798-
db.security.addPermissionToRole('User', p)
799-
p = db.security.getPermission('Create', cl)
800-
db.security.addPermissionToRole('User', p)
806+
db.security.addPermissionToRole('User', 'View', cl)
807+
db.security.addPermissionToRole('User', 'Edit', cl)
808+
db.security.addPermissionToRole('User', 'Create', cl)
801809
for cl in 'priority', 'status':
802-
p = db.security.getPermission('View', cl)
803-
db.security.addPermissionToRole('User', p)
810+
db.security.addPermissionToRole('User', 'View', cl)
804811

805812
# May users view other user information? Comment these lines out
806813
# if you don't want them to
807-
p = db.security.getPermission('View', 'user')
808-
db.security.addPermissionToRole('User', p)
814+
db.security.addPermissionToRole('User', 'View', 'user')
809815

810-
# Users should be able to edit their own details. Note that this
811-
# permission is limited to only the situation where the Viewed or
812-
# Edited item is their own.
816+
# Users should be able to edit their own details -- this permission
817+
# is limited to only the situation where the Viewed or Edited item
818+
# is their own.
813819
def own_record(db, userid, itemid):
814820
'''Determine whether the userid matches the item being accessed.'''
815821
return userid == itemid
816822
p = db.security.addPermission(name='View', klass='user', check=own_record,
817823
description="User is allowed to view their own user details")
824+
db.security.addPermissionToRole('User', p)
818825
p = db.security.addPermission(name='Edit', klass='user', check=own_record,
819826
description="User is allowed to edit their own user details")
820827
db.security.addPermissionToRole('User', p)
@@ -825,35 +832,31 @@ Put together, these settings appear in the tracker's ``schema.py`` file::
825832
# Let anonymous users access the web interface. Note that almost all
826833
# trackers will need this Permission. The only situation where it's not
827834
# required is in a tracker that uses an HTTP Basic Authenticated front-end.
828-
p = db.security.getPermission('Web Access')
829-
db.security.addPermissionToRole('Anonymous', p)
835+
db.security.addPermissionToRole('Anonymous', 'Web Access')
830836

831837
# Let anonymous users access the email interface (note that this implies
832838
# that they will be registered automatically, hence they will need the
833839
# "Create" user Permission below)
834-
p = db.security.getPermission('Email Access')
835-
db.security.addPermissionToRole('Anonymous', p)
840+
# This is disabled by default to stop spam from auto-registering users on
841+
# public trackers.
842+
#db.security.addPermissionToRole('Anonymous', 'Email Access')
836843

837844
# Assign the appropriate permissions to the anonymous user's Anonymous
838845
# Role. Choices here are:
839846
# - Allow anonymous users to register
840-
p = db.security.getPermission('Create', 'user')
841-
db.security.addPermissionToRole('Anonymous', p)
847+
db.security.addPermissionToRole('Anonymous', 'Create', 'user')
842848

843849
# Allow anonymous users access to view issues (and the related, linked
844850
# information)
845851
for cl in 'issue', 'file', 'msg', 'keyword', 'priority', 'status':
846-
p = db.security.getPermission('View', cl)
847-
db.security.addPermissionToRole('Anonymous', p)
852+
db.security.addPermissionToRole('Anonymous', 'View', cl)
848853

849854
# [OPTIONAL]
850855
# Allow anonymous users access to create or edit "issue" items (and the
851856
# related file and message items)
852857
#for cl in 'issue', 'file', 'msg':
853-
# p = db.security.getPermission('Create', cl)
854-
# db.security.addPermissionToRole('Anonymous', p)
855-
# p = db.security.getPermission('Edit', cl)
856-
# db.security.addPermissionToRole('Anonymous', p)
858+
# db.security.addPermissionToRole('Anonymous', 'Create', cl)
859+
# db.security.addPermissionToRole('Anonymous', 'Edit', cl)
857860

858861

859862
Automatic Permission Checks
@@ -887,6 +890,9 @@ New users are assigned the Roles defined in the config file as:
887890
- NEW_WEB_USER_ROLES
888891
- NEW_EMAIL_USER_ROLES
889892

893+
The `users may only edit their issues`_ example shows customisation of
894+
these parameters.
895+
890896

891897
Changing Access Controls
892898
------------------------

roundup/cgi/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.212 2005-01-05 22:00:39 richard Exp $
1+
# $Id: client.py,v 1.213 2005-04-13 03:38:23 richard Exp $
22

33
"""WWW request handler (also used in the stand-alone server).
44
"""
@@ -26,6 +26,7 @@ def initialiseSecurity(security):
2626
security.addPermissionToRole('Admin', p)
2727

2828
# doing Role stuff through the web - make sure Admin can
29+
# TODO: deprecate this and use a property-based control
2930
p = security.addPermission(name="Web Roles",
3031
description="User may manipulate user Roles through the web")
3132
security.addPermissionToRole('Admin', p)

roundup/mailgw.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class node. Any parts of other types are each stored in separate files
7272
an exception, the original message is bounced back to the sender with the
7373
explanatory message given in the exception.
7474
75-
$Id: mailgw.py,v 1.163 2005-02-15 23:45:28 richard Exp $
75+
$Id: mailgw.py,v 1.164 2005-04-13 03:38:22 richard Exp $
7676
"""
7777
__docformat__ = 'restructuredtext'
7878

@@ -768,7 +768,8 @@ def handle_message(self, message):
768768
# Don't create users if anonymous isn't allowed to register
769769
create = 1
770770
anonid = self.db.user.lookup('anonymous')
771-
if not self.db.security.hasPermission('Create', anonid, 'user'):
771+
if not (self.db.security.hasPermission('Create', anonid, 'user')
772+
and self.db.security.hasPermission('Email Access', anonid)):
772773
create = 0
773774

774775
# ok, now figure out who the author is - create a new user if the

templates/classic/schema.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ def own_record(db, userid, itemid):
124124
# Let anonymous users access the email interface (note that this implies
125125
# that they will be registered automatically, hence they will need the
126126
# "Create" user Permission below)
127-
db.security.addPermissionToRole('Anonymous', 'Email Access')
127+
# This is disabled by default to stop spam from auto-registering users on
128+
# public trackers.
129+
#db.security.addPermissionToRole('Anonymous', 'Email Access')
128130

129131
# Assign the appropriate permissions to the anonymous user's Anonymous
130132
# Role. Choices here are:

0 commit comments

Comments
 (0)