267 def context(self, **kwargs): |
267 def context(self, **kwargs): |
268 context = super(EntityUpdatedNotificationView, self).context(**kwargs) |
268 context = super(EntityUpdatedNotificationView, self).context(**kwargs) |
269 changes = self.req.transaction_data['changes'][self.rset[0][0]] |
269 changes = self.req.transaction_data['changes'][self.rset[0][0]] |
270 _ = self.req._ |
270 _ = self.req._ |
271 formatted_changes = [] |
271 formatted_changes = [] |
|
272 entity = self.entity(self.row or 0, self.col or 0) |
272 for attr, oldvalue, newvalue in sorted(changes): |
273 for attr, oldvalue, newvalue in sorted(changes): |
273 # check current user has permission to see the attribute |
274 # check current user has permission to see the attribute |
274 rschema = self.vreg.schema[attr] |
275 rschema = self.vreg.schema[attr] |
275 if rschema.final: |
276 if rschema.final: |
276 if not rschema.has_perm(self.req, 'read', eid=self.rset[0][0]): |
277 rdef = entity.e_schema.rdef(rschema) |
|
278 if not rdef.has_perm(self.req, 'read', eid=self.rset[0][0]): |
277 continue |
279 continue |
278 # XXX suppose it's a subject relation... |
280 # XXX suppose it's a subject relation... |
279 elif not rschema.has_perm(self.req, 'read', fromeid=self.rset[0][0]): |
281 elif not rschema.has_perm(self.req, 'read', fromeid=self.rset[0][0]): # XXX toeid |
280 continue |
282 continue |
281 if attr in self.no_detailed_change_attrs: |
283 if attr in self.no_detailed_change_attrs: |
282 msg = _('%s updated') % _(attr) |
284 msg = _('%s updated') % _(attr) |
283 elif oldvalue not in (None, ''): |
285 elif oldvalue not in (None, ''): |
284 msg = _('%(attr)s updated from %(oldvalue)s to %(newvalue)s') % { |
286 msg = _('%(attr)s updated from %(oldvalue)s to %(newvalue)s') % { |