hooks/security.py
changeset 10156 57b68193413c
parent 10114 6f4b4567b77d
parent 10153 85cbf16fbb57
child 10388 90fcddcce166
equal deleted inserted replaced
10134:a1364ac56bb9 10156:57b68193413c
    66             if perms == ():
    66             if perms == ():
    67                 # That means an immutable attribute; as an optimization, avoid
    67                 # That means an immutable attribute; as an optimization, avoid
    68                 # going through check_perm.
    68                 # going through check_perm.
    69                 raise Unauthorized(action, str(rdef))
    69                 raise Unauthorized(action, str(rdef))
    70             rdef.check_perm(cnx, action, eid=eid)
    70             rdef.check_perm(cnx, action, eid=eid)
       
    71 
       
    72     if action == 'add' and not etypechecked:
       
    73         # think about cnx.create_entity('Foo')
       
    74         # the standard metadata were inserted by a hook
       
    75         # with a bypass ... we conceptually need to check
       
    76         # the eid attribute at *creation* time
       
    77         entity.cw_check_perm(action)
    71 
    78 
    72 
    79 
    73 class CheckEntityPermissionOp(hook.DataOperationMixIn, hook.LateOperation):
    80 class CheckEntityPermissionOp(hook.DataOperationMixIn, hook.LateOperation):
    74     def precommit_event(self):
    81     def precommit_event(self):
    75         cnx = self.cnx
    82         cnx = self.cnx