sobjects/notification.py
changeset 4835 13b0b96d7982
parent 4719 aaed3f813ef8
child 4930 9fcc9ae2aebe
equal deleted inserted replaced
4834:b718626a0e60 4835:13b0b96d7982
    31                 'X primary_email E, E address A')
    31                 'X primary_email E, E address A')
    32 
    32 
    33     def recipients(self):
    33     def recipients(self):
    34         mode = self._cw.vreg.config['default-recipients-mode']
    34         mode = self._cw.vreg.config['default-recipients-mode']
    35         if mode == 'users':
    35         if mode == 'users':
    36             # use unsafe execute else we may don't have the right to see users
    36             execute = self._cw.execute
    37             # to notify...
       
    38             execute = self._cw.unsafe_execute
       
    39             dests = [(u.get_email(), u.property_value('ui.language'))
    37             dests = [(u.get_email(), u.property_value('ui.language'))
    40                      for u in execute(self.user_rql, build_descr=True, propagate=True).entities()]
    38                      for u in execute(self.user_rql, build_descr=True).entities()]
    41         elif mode == 'default-dest-addrs':
    39         elif mode == 'default-dest-addrs':
    42             lang = self._cw.vreg.property_value('ui.language')
    40             lang = self._cw.vreg.property_value('ui.language')
    43             dests = zip(self._cw.vreg.config['default-dest-addrs'], repeat(lang))
    41             dests = zip(self._cw.vreg.config['default-dest-addrs'], repeat(lang))
    44         else: # mode == 'none'
    42         else: # mode == 'none'
    45             dests = []
    43             dests = []
   156             if rschema.final:
   154             if rschema.final:
   157                 rdef = entity.e_schema.rdef(rschema)
   155                 rdef = entity.e_schema.rdef(rschema)
   158                 if not rdef.has_perm(self._cw, 'read', eid=self.cw_rset[0][0]):
   156                 if not rdef.has_perm(self._cw, 'read', eid=self.cw_rset[0][0]):
   159                     continue
   157                     continue
   160             # XXX suppose it's a subject relation...
   158             # XXX suppose it's a subject relation...
   161             elif not rschema.has_perm(self._cw, 'read', fromeid=self.cw_rset[0][0]): # XXX toeid
   159             elif not rschema.has_perm(self._cw, 'read',
       
   160                                       fromeid=self.cw_rset[0][0]):
   162                 continue
   161                 continue
   163             if attr in self.no_detailed_change_attrs:
   162             if attr in self.no_detailed_change_attrs:
   164                 msg = _('%s updated') % _(attr)
   163                 msg = _('%s updated') % _(attr)
   165             elif oldvalue not in (None, ''):
   164             elif oldvalue not in (None, ''):
   166                 msg = _('%(attr)s updated from %(oldvalue)s to %(newvalue)s') % {
   165                 msg = _('%(attr)s updated from %(oldvalue)s to %(newvalue)s') % {