147 def context(self, **kwargs): |
147 def context(self, **kwargs): |
148 context = super(EntityUpdatedNotificationView, self).context(**kwargs) |
148 context = super(EntityUpdatedNotificationView, self).context(**kwargs) |
149 changes = self.req.transaction_data['changes'][self.rset[0][0]] |
149 changes = self.req.transaction_data['changes'][self.rset[0][0]] |
150 _ = self.req._ |
150 _ = self.req._ |
151 formatted_changes = [] |
151 formatted_changes = [] |
|
152 entity = self.entity(self.row or 0, self.col or 0) |
152 for attr, oldvalue, newvalue in sorted(changes): |
153 for attr, oldvalue, newvalue in sorted(changes): |
153 # check current user has permission to see the attribute |
154 # check current user has permission to see the attribute |
154 rschema = self.vreg.schema[attr] |
155 rschema = self.vreg.schema[attr] |
155 if rschema.final: |
156 if rschema.final: |
156 if not rschema.has_perm(self.req, 'read', eid=self.rset[0][0]): |
157 rdef = entity.e_schema.rdef(rschema) |
|
158 if not rdef.has_perm(self.req, 'read', eid=self.rset[0][0]): |
157 continue |
159 continue |
158 # XXX suppose it's a subject relation... |
160 # XXX suppose it's a subject relation... |
159 elif not rschema.has_perm(self.req, 'read', fromeid=self.rset[0][0]): |
161 elif not rschema.has_perm(self.req, 'read', fromeid=self.rset[0][0]): # XXX toeid |
160 continue |
162 continue |
161 if attr in self.no_detailed_change_attrs: |
163 if attr in self.no_detailed_change_attrs: |
162 msg = _('%s updated') % _(attr) |
164 msg = _('%s updated') % _(attr) |
163 elif oldvalue not in (None, ''): |
165 elif oldvalue not in (None, ''): |
164 msg = _('%(attr)s updated from %(oldvalue)s to %(newvalue)s') % { |
166 msg = _('%(attr)s updated from %(oldvalue)s to %(newvalue)s') % { |