cubicweb/hooks/security.py
changeset 11765 9cb215e833b0
parent 11057 0b59724cb3f2
child 11767 432f87a63057
--- a/cubicweb/hooks/security.py	Thu Oct 06 12:15:50 2016 +0200
+++ b/cubicweb/hooks/security.py	Sat Oct 01 11:56:27 2016 +0200
@@ -89,8 +89,8 @@
     def precommit_event(self):
         cnx = self.cnx
         for action, rschema, eidfrom, eidto in self.get_data():
-            rdef = rschema.rdef(cnx.entity_metas(eidfrom)['type'],
-                                cnx.entity_metas(eidto)['type'])
+            rdef = rschema.rdef(cnx.entity_type(eidfrom),
+                                cnx.entity_type(eidto))
             rdef.check_perm(cnx, action, fromeid=eidfrom, toeid=eidto)
 
 
@@ -165,8 +165,8 @@
             if rschema.inlined and skip_inlined_relation_security(
                     self._cw, rschema, self.eidfrom):
                 return
-            rdef = rschema.rdef(self._cw.entity_metas(self.eidfrom)['type'],
-                                self._cw.entity_metas(self.eidto)['type'])
+            rdef = rschema.rdef(self._cw.entity_type(self.eidfrom),
+                                self._cw.entity_type(self.eidto))
             rdef.check_perm(self._cw, 'add', fromeid=self.eidfrom, toeid=self.eidto)
 
 
@@ -187,8 +187,8 @@
                 CheckRelationPermissionOp.get_instance(self._cw).add_data(
                     ('add', rschema, self.eidfrom, self.eidto) )
             else:
-                rdef = rschema.rdef(self._cw.entity_metas(self.eidfrom)['type'],
-                                    self._cw.entity_metas(self.eidto)['type'])
+                rdef = rschema.rdef(self._cw.entity_type(self.eidfrom),
+                                    self._cw.entity_type(self.eidto))
                 rdef.check_perm(self._cw, 'add', fromeid=self.eidfrom, toeid=self.eidto)
 
 
@@ -204,6 +204,6 @@
         if rschema.inlined and skip_inlined_relation_security(
                 self._cw, rschema, self.eidfrom):
             return
-        rdef = rschema.rdef(self._cw.entity_metas(self.eidfrom)['type'],
-                            self._cw.entity_metas(self.eidto)['type'])
+        rdef = rschema.rdef(self._cw.entity_type(self.eidfrom),
+                            self._cw.entity_type(self.eidto))
         rdef.check_perm(self._cw, 'delete', fromeid=self.eidfrom, toeid=self.eidto)