'Method for checking a permission for the current user ( based on roles ) to perform a
specific action on an item, which must be one of:
Dataset, Library, LibraryFolder, LibraryDataset, LibraryDatasetDatasetAssociation'

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
    if (action == self.permitted_actions.DATASET_ACCESS):
        for item_action in item_actions:
            if (item_action.role not in roles):
                break
        else:
            ret_val = True
    else:
        for item_action in item_actions:
            if (item_action.role in roles):
                ret_val = True
                break
    return ret_val
