cubicweb/hooks/syncschema.py
changeset 11765 9cb215e833b0
parent 11763 39df042f4ab4
child 11767 432f87a63057
equal deleted inserted replaced
11764:6ab14a1afb65 11765:9cb215e833b0
  1345         'update_permission')
  1345         'update_permission')
  1346     events = ('after_add_relation',)
  1346     events = ('after_add_relation',)
  1347 
  1347 
  1348     def __call__(self):
  1348     def __call__(self):
  1349         action = self.rtype.split('_', 1)[0]
  1349         action = self.rtype.split('_', 1)[0]
  1350         if self._cw.entity_metas(self.eidto)['type'] == 'CWGroup':
  1350         if self._cw.entity_type(self.eidto) == 'CWGroup':
  1351             MemSchemaPermissionAdd(self._cw, action=action, eid=self.eidfrom,
  1351             MemSchemaPermissionAdd(self._cw, action=action, eid=self.eidfrom,
  1352                                    group_eid=self.eidto)
  1352                                    group_eid=self.eidto)
  1353         else:  # RQLExpression
  1353         else:  # RQLExpression
  1354             expr = self._cw.entity_from_eid(self.eidto).expression
  1354             expr = self._cw.entity_from_eid(self.eidto).expression
  1355             MemSchemaPermissionAdd(self._cw, action=action, eid=self.eidfrom,
  1355             MemSchemaPermissionAdd(self._cw, action=action, eid=self.eidfrom,
  1366 
  1366 
  1367     def __call__(self):
  1367     def __call__(self):
  1368         if self._cw.deleted_in_transaction(self.eidfrom):
  1368         if self._cw.deleted_in_transaction(self.eidfrom):
  1369             return
  1369             return
  1370         action = self.rtype.split('_', 1)[0]
  1370         action = self.rtype.split('_', 1)[0]
  1371         if self._cw.entity_metas(self.eidto)['type'] == 'CWGroup':
  1371         if self._cw.entity_type(self.eidto) == 'CWGroup':
  1372             MemSchemaPermissionDel(self._cw, action=action, eid=self.eidfrom,
  1372             MemSchemaPermissionDel(self._cw, action=action, eid=self.eidfrom,
  1373                                    group_eid=self.eidto)
  1373                                    group_eid=self.eidto)
  1374         else:  # RQLExpression
  1374         else:  # RQLExpression
  1375             expr = self._cw.entity_from_eid(self.eidto).expression
  1375             expr = self._cw.entity_from_eid(self.eidto).expression
  1376             MemSchemaPermissionDel(self._cw, action=action, eid=self.eidfrom,
  1376             MemSchemaPermissionDel(self._cw, action=action, eid=self.eidfrom,