schema.py
changeset 9817 bb719d857421
parent 9711 59616edc20d7
child 9892 928732ec00dd
child 9984 793377697c81
equal deleted inserted replaced
9813:c20956f5862d 9817:bb719d857421
   561     clear_cache(self, 'get_rqlexprs')
   561     clear_cache(self, 'get_rqlexprs')
   562     clear_cache(self, 'get_groups')
   562     clear_cache(self, 'get_groups')
   563 PermissionMixIn.set_action_permissions = set_action_permissions
   563 PermissionMixIn.set_action_permissions = set_action_permissions
   564 
   564 
   565 def has_local_role(self, action):
   565 def has_local_role(self, action):
   566     """return true if the action *may* be granted localy (eg either rql
   566     """return true if the action *may* be granted locally (eg either rql
   567     expressions or the owners group are used in security definition)
   567     expressions or the owners group are used in security definition)
   568 
   568 
   569     XXX this method is only there since we don't know well how to deal with
   569     XXX this method is only there since we don't know well how to deal with
   570     'add' action checking. Also find a better name would be nice.
   570     'add' action checking. Also find a better name would be nice.
   571     """
   571     """
   583         return False
   583         return False
   584     return self.has_local_role(action) or self.has_perm(req, action)
   584     return self.has_local_role(action) or self.has_perm(req, action)
   585 PermissionMixIn.may_have_permission = may_have_permission
   585 PermissionMixIn.may_have_permission = may_have_permission
   586 
   586 
   587 def has_perm(self, _cw, action, **kwargs):
   587 def has_perm(self, _cw, action, **kwargs):
   588     """return true if the action is granted globaly or localy"""
   588     """return true if the action is granted globally or locally"""
   589     try:
   589     try:
   590         self.check_perm(_cw, action, **kwargs)
   590         self.check_perm(_cw, action, **kwargs)
   591         return True
   591         return True
   592     except Unauthorized:
   592     except Unauthorized:
   593         return False
   593         return False