Changeset 474 for trunk/email2trac.py.in
- Timestamp:
- 08/09/10 14:27:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r472 r474 583 583 ########## TRAC ticket functions ########################################################### 584 584 585 def check_permission_participants(self, tkt ):585 def check_permission_participants(self, tkt, action): 586 586 """ 587 587 Check if the mailer is allowed to update the ticket … … 595 595 596 596 perm = PermissionSystem(self.env) 597 if perm.check_permission( 'TICKET_MODIFY', self.author):597 if perm.check_permission(action, self.author): 598 598 self.logger.debug('ALLOW, %s has trac permission to update the ticket' %(self.author)) 599 599 600 600 return True 601 602 else:603 return False604 601 605 606 602 # Is the updater in the CC? 607 603 try: … … 614 610 615 611 except KeyError: 616 return False 612 pass 613 614 return False 617 615 618 616 def check_permission(self, tkt, action): … … 621 619 - TICKET_CREATE 622 620 - TICKET_MODIFY 621 - TICKET_APPEND 622 - TICKET_CHGPROP 623 623 624 624 There are three models: … … 638 638 639 639 elif self.parameters.ticket_permission_system in ['update_restricted_to_participants']: 640 if action in ['TICKET_MODIFY']: 641 return (self.check_permission_participants(tkt)) 642 else: 643 return True 640 return (self.check_permission_participants(tkt, action)) 644 641 645 642 # Default is to allow everybody ticket updates and ticket creation … … 648 645 649 646 650 def update_ticket_fields(self, ticket, user_dict, use_default=None):647 def update_ticket_fields(self, ticket, user_dict, new_ticket=None): 651 648 """ 652 649 This will update the ticket fields. It will check if the … … 656 653 - If the value supplied is valid for the ticket field. 657 654 If not then there are two options: 658 1) Skip the value ( use_default=None)659 2) Set default value for field ( use_default=1)655 1) Skip the value (new_ticket=None) 656 2) Set default value for field (new_ticket=1) 660 657 """ 661 658 self.logger.debug("function update_ticket_fields") 659 660 ## Check only permission model on ticket updates 661 # 662 if not new_ticket: 663 if self.parameters.ticket_permission_system: 664 if not self.check_permission(ticket, 'TICKET_CHGPROP'): 665 self.logger.info('Reporter: %s has no permission to change ticket properties' %self.author) 666 return False 662 667 663 668 # Build a system dictionary from the ticket fields … … 706 711 # Must we set a default if value is not allowed 707 712 # 708 if use_default:713 if new_ticket: 709 714 value = self.get_config('ticket', 'default_%s' %(field) ) 710 715 … … 773 778 # 774 779 if self.parameters.ticket_permission_system: 775 if not self.check_permission(tkt, 'TICKET_ MODIFY'):776 self.logger.info('Reporter: %s has no permission to modifytickets' %self.author)780 if not self.check_permission(tkt, 'TICKET_APPEND'): 781 self.logger.info('Reporter: %s has no permission to add comments or attachments to tickets' %self.author) 777 782 return False 778 783 … … 925 930 self.print_unicode(s) 926 931 927 self.update_ticket_fields(ticket, user_dict, use_default=1)932 self.update_ticket_fields(ticket, user_dict, new_ticket=1) 928 933 929 934 if 'status' not in user_dict.keys():
Note: See TracChangeset
for help on using the changeset viewer.