cubicweb/schema.py
changeset 11765 9cb215e833b0
parent 11681 b23d58050076
child 11767 432f87a63057
equal deleted inserted replaced
11764:6ab14a1afb65 11765:9cb215e833b0
   935         """return true if the action is granted globally or locally"""
   935         """return true if the action is granted globally or locally"""
   936         if self.final:
   936         if self.final:
   937             assert not ('fromeid' in kwargs or 'toeid' in kwargs), kwargs
   937             assert not ('fromeid' in kwargs or 'toeid' in kwargs), kwargs
   938             assert action in ('read', 'update')
   938             assert action in ('read', 'update')
   939             if 'eid' in kwargs:
   939             if 'eid' in kwargs:
   940                 subjtype = _cw.entity_metas(kwargs['eid'])['type']
   940                 subjtype = _cw.entity_type(kwargs['eid'])
   941             else:
   941             else:
   942                 subjtype = objtype = None
   942                 subjtype = objtype = None
   943         else:
   943         else:
   944             assert 'eid' not in kwargs, kwargs
   944             assert 'eid' not in kwargs, kwargs
   945             assert action in ('read', 'add', 'delete')
   945             assert action in ('read', 'add', 'delete')
   946             if 'fromeid' in kwargs:
   946             if 'fromeid' in kwargs:
   947                 subjtype = _cw.entity_metas(kwargs['fromeid'])['type']
   947                 subjtype = _cw.entity_type(kwargs['fromeid'])
   948             elif 'frometype' in kwargs:
   948             elif 'frometype' in kwargs:
   949                 subjtype = kwargs.pop('frometype')
   949                 subjtype = kwargs.pop('frometype')
   950             else:
   950             else:
   951                 subjtype = None
   951                 subjtype = None
   952             if 'toeid' in kwargs:
   952             if 'toeid' in kwargs:
   953                 objtype = _cw.entity_metas(kwargs['toeid'])['type']
   953                 objtype = _cw.entity_type(kwargs['toeid'])
   954             elif 'toetype' in kwargs:
   954             elif 'toetype' in kwargs:
   955                 objtype = kwargs.pop('toetype')
   955                 objtype = kwargs.pop('toetype')
   956             else:
   956             else:
   957                 objtype = None
   957                 objtype = None
   958         if objtype and subjtype:
   958         if objtype and subjtype: