'Method for checking a permission for the current user ( based on roles ) to perform a
specific action on an item'

def allow_action(self, roles, action, item):

    item_actions = self.get_item_actions(action, item)
    if (not item_actions):
        return (action.model == 'restrict')
    ret_val = False
    for item_action in item_actions:
        if (item_action.role in roles):
            ret_val = True
            break
    return ret_val
