hooks/security.py
changeset 4190 742e3eb16f81
parent 4048 12c4f7e2bed6
child 4252 6c4f109c2b03
equal deleted inserted replaced
4189:bd552b341334 4190:742e3eb16f81
    98             if (self.eidfrom, self.rtype, self.eidto) in nocheck:
    98             if (self.eidfrom, self.rtype, self.eidto) in nocheck:
    99                 return
    99                 return
   100             rschema = self._cw.repo.schema[self.rtype]
   100             rschema = self._cw.repo.schema[self.rtype]
   101             rdef = rschema.rdef(self._cw.describe(self.eidfrom)[0],
   101             rdef = rschema.rdef(self._cw.describe(self.eidfrom)[0],
   102                                 self._cw.describe(self.eidto)[0])
   102                                 self._cw.describe(self.eidto)[0])
   103             rdef.check_perm(session, 'add', fromeid=self.eidfrom, toeid=self.eidto)
   103             rdef.check_perm(self._cw, 'add', fromeid=self.eidfrom, toeid=self.eidto)
   104 
   104 
   105 
   105 
   106 class AfterAddRelationSecurityHook(SecurityHook):
   106 class AfterAddRelationSecurityHook(SecurityHook):
   107     __regid__ = 'securityafteraddrelation'
   107     __regid__ = 'securityafteraddrelation'
   108     events = ('after_add_relation',)
   108     events = ('after_add_relation',)
   133         if (self.eidfrom, self.rtype, self.eidto) in nocheck:
   133         if (self.eidfrom, self.rtype, self.eidto) in nocheck:
   134             return
   134             return
   135         rschema = self._cw.repo.schema[self.rtype]
   135         rschema = self._cw.repo.schema[self.rtype]
   136         rdef = rschema.rdef(self._cw.describe(self.eidfrom)[0],
   136         rdef = rschema.rdef(self._cw.describe(self.eidfrom)[0],
   137                             self._cw.describe(self.eidto)[0])
   137                             self._cw.describe(self.eidto)[0])
   138         rdef.check_perm(self._cw, 'add', fromeid=self.eidfrom, toeid=self.eidto)
   138         rdef.check_perm(self._cw, 'delete', fromeid=self.eidfrom, toeid=self.eidto)
   139 
   139