comparison roundup/mailgw.py @ 2747:8b6cd1c5d549 maint-0.7

pydotorg-specific change to mailgw to handle bizzaro permissions ;)
author Richard Jones <richard@users.sourceforge.net>
date Mon, 11 Oct 2004 05:20:37 +0000
parents 7f24a0222d36
children 07166758e412
comparison
equal deleted inserted replaced
2746:adce02da25b7 2747:8b6cd1c5d549
70 set() method to add the message to the item's spool; in the second case we 70 set() method to add the message to the item's spool; in the second case we
71 are calling the create() method to create a new node). If an auditor raises 71 are calling the create() method to create a new node). If an auditor raises
72 an exception, the original message is bounced back to the sender with the 72 an exception, the original message is bounced back to the sender with the
73 explanatory message given in the exception. 73 explanatory message given in the exception.
74 74
75 $Id: mailgw.py,v 1.149.2.3 2004-09-29 08:47:59 a1s Exp $ 75 $Id: mailgw.py,v 1.149.2.4 2004-10-11 05:20:37 richard Exp $
76 """ 76 """
77 __docformat__ = 'restructuredtext' 77 __docformat__ = 'restructuredtext'
78 78
79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri 79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
80 import time, random, sys 80 import time, random, sys
570 import traceback 570 import traceback
571 traceback.print_exc(None, s) 571 traceback.print_exc(None, s)
572 m.append(s.getvalue()) 572 m.append(s.getvalue())
573 self.mailer.bounce_message(message, sendto, m) 573 self.mailer.bounce_message(message, sendto, m)
574 574
575 def hasPermissions(self, author, classname, nodeid):
576 # make sure they're allowed to edit this class of information
577 return self.db.security.hasPermission('Edit', author, classname)
578
575 def handle_message(self, message): 579 def handle_message(self, message):
576 ''' message - a Message instance 580 ''' message - a Message instance
577 581
578 Parse the message as per the module docstring. 582 Parse the message as per the module docstring.
579 ''' 583 '''
788 else: 792 else:
789 # we're registered and we're _still_ not allowed access 793 # we're registered and we're _still_ not allowed access
790 raise Unauthorized, 'You are not permitted to access '\ 794 raise Unauthorized, 'You are not permitted to access '\
791 'this tracker.' 795 'this tracker.'
792 796
793 # make sure they're allowed to edit this class of information 797 if not self.hasPermissions(author, classname, nodeid):
794 if not self.db.security.hasPermission('Edit', author, classname):
795 raise Unauthorized, 'You are not permitted to edit %s.'%classname 798 raise Unauthorized, 'You are not permitted to edit %s.'%classname
796 799
797 # the author may have been created - make sure the change is 800 # the author may have been created - make sure the change is
798 # committed before we reopen the database 801 # committed before we reopen the database
799 self.db.commit() 802 self.db.commit()

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