示例#1
0
 def remove_relations(self, req, rellist):
     relsys = RelationsSystem(self.env)
     for relid in rellist:
         relation = Relation.load_by_relation_id(self.env, relid)
         resource = ResourceIdSerializer.get_resource_by_id(
             relation.destination)
         if 'TICKET_MODIFY' in req.perm(resource):
             relsys.delete(relid)
         else:
             add_warning(req,
                 _('Not enough permissions to remove relation "%s"' % relid))
示例#2
0
 def remove_relations(self, req, rellist):
     relsys = RelationsSystem(self.env)
     for relid in rellist:
         relation = Relation.load_by_relation_id(self.env, relid)
         resource = \
             ResourceIdSerializer.get_resource_by_id(relation.destination)
         if 'TICKET_MODIFY' in req.perm(resource):
             relsys.delete(relid)
         else:
             add_warning(req, _('Insufficient permissions to remove '
                                'relation "%(relation)s"', relation=relid))
示例#3
0
 def notify(self, relation, deleted=False):
     self.relation = relation
     source = ResourceIdSerializer.get_resource_by_id(relation.source)
     if source.realm == 'ticket':
         self.imitate_ticket_notification = True
         helper = TicketRelationsSpecifics(self.env)
         t = helper._create_ticket_by_full_id(source)
         self.template = Chrome(self.env).load_template(
             TicketNotifyEmail.template_name, method='text')
         if deleted:
             modtime = deleted
         else:
             modtime = from_utimestamp(relation.time)
         TicketNotifyEmail.notify(self, t, newticket=False, modtime=modtime)
     else:
         self._generic_notify(relation, deleted)
示例#4
0
 def notify(self, relation, deleted=False):
     self.relation = relation
     source = ResourceIdSerializer.get_resource_by_id(relation.source)
     if source.realm == 'ticket':
         self.imitate_ticket_notification = True
         helper = TicketRelationsSpecifics(self.env)
         t = helper._create_ticket_by_full_id(source)
         self.template = Chrome(self.env).load_template(
             TicketNotifyEmail.template_name, method='text')
         if deleted:
             modtime = deleted
         else:
             modtime = from_utimestamp(relation.time)
         TicketNotifyEmail.notify(self, t, newticket=False, modtime=modtime)
     else:
         self._generic_notify(relation, deleted)
示例#5
0
 def get_resource_name(self, resource_id):
     resource = ResourceIdSerializer.get_resource_by_id(resource_id)
     return get_resource_shortname(self.env, resource)