Beispiel #1
0
def restricted_resource_view_list(context, data_dict):
    model = context['model']
    id = _get_or_bust(data_dict, 'id')
    resource = model.Resource.get(id)
    if not resource:
        raise NotFound
    authorized = auth.restricted_resource_show(
        context, {'id': resource.get('id'), 'resource': resource}).get('success', False)
    if not authorized:
        return []
    else:
        return resource_view_list(context, data_dict)
def initiatives_resource_view_list(context, data_dict):
    model = context["model"]
    id = _get_or_bust(data_dict, "id")
    resource = model.Resource.get(id)
    if not resource:
        raise NotFound
    authorized = auth.initiatives_resource_show(context, {
        "id": resource.get("id"),
        "resource": resource
    }).get("success", False)
    if not authorized:
        return []
    else:
        return resource_view_list(context, data_dict)
Beispiel #3
0
def restricted_resource_view_list(context, data_dict):
    package = data_dict.get('package')
    logger.warning('restricted_resource_view_list was called. Package: %s' %
                   package)
    model = context['model']
    id = _get_or_bust(data_dict, 'id')
    resource = model.Resource.get(id)
    if not resource:
        raise NotFound
    authorized = auth.restricted_resource_show(context, {
        'id': resource.get('id'),
        'resource': resource
    }).get('success', False)
    if not authorized:
        return []
    else:
        return resource_view_list(context, data_dict)