Changeset 398 for trunk/email2trac.py.in
- Timestamp:
- 07/15/10 14:04:11 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r397 r398 663 663 ########## TRAC ticket functions ########################################################### 664 664 665 def check_permission(self, action): 665 def check_permission_participants(self, tkt): 666 """ 667 Check if the mailer is allowed to update the ticket 668 """ 669 670 if tkt['reporter'].lower() in [self.author, self.email_addr]: 671 if self.DEBUG: 672 print 'ALLOW, %s is the ticket reporter' %(self.email_addr) 673 return True 674 675 perm = PermissionSystem(self.env) 676 if perm.check_permission('TICKET_MODIFY', self.author): 677 if self.DEBUG: 678 print 'ALLOW, %s has trac permission to update the ticket' %(self.author) 679 return True 680 else: 681 return False 682 683 684 # Is the updater in the CC? 685 try: 686 cc_list = tkt['cc'].split(',') 687 for cc in cc_list: 688 if self.email_addr.lower() in cc.strip(): 689 690 if self.DEBUG: 691 print 'ALLOW, %s is in the CC' %(self.email_addr) 692 693 return True 694 695 except KeyError: 696 return False 697 698 def check_permission(self, tkt, action): 666 699 """ 667 700 check if the reporter has the right permission for the action: … … 678 711 679 712 if self.TICKET_PERMISSION_SYSTEM in ['trac']: 713 680 714 perm = PermissionSystem(self.env) 681 715 if perm.check_permission(action, self.author): … … 683 717 else: 684 718 return False 719 720 elif self.TICKET_PERMISSION_SYSTEM in ['update_restricted_to_participants']: 721 if action in ['TICKET_MODIFY']: 722 return (self.check_permission_participants(tkt)) 723 else: 724 return True 725 726 # Default is to allow everybody ticket updates and ticket creation 685 727 else: 686 728 return True … … 810 852 return False 811 853 854 # Check the permission of the reporter 855 # 856 if self.TICKET_PERMISSION_SYSTEM: 857 if not self.check_permission(tkt, 'TICKET_MODIFY'): 858 print 'Reporter: %s has no permission to modify tickets' %self.author 859 return False 860 812 861 # How many changes has this ticket 813 862 cnum = len(tkt.get_changelog()) … … 1015 1064 # 1016 1065 if self.TICKET_PERMISSION_SYSTEM: 1017 if not self.check_permission( 'TICKET_CREATE'):1066 if not self.check_permission(tkt, 'TICKET_CREATE'): 1018 1067 print 'Reporter: %s has no permission to create tickets' %self.author 1019 1068 return False
Note: See TracChangeset
for help on using the changeset viewer.