Beispiel #1
0
def act_build_from_clone(request, id):
    request.breadcrumbs([("Threat Actor Edit", "/threat_actor/build/")])
    static = act_views.get_static(request.user)
    try:
        id_ns = IDManager().get_namespace()
    except NamespaceNotConfigured as e:
        messages.info(request, e.message)
        return redirect('/setup')

    return render(request, 'cert-clone-build.html', {
        'id': None,
        'id_ns': id_ns,
        'mode': 'Build',
        'object_type': 'threat_actor',
        'edit_allowed': user_can_edit(request.user, id),
        'ajax_uri': reverse('threat_actor_ajax'),
        'default_tlp': configuration.by_key('default_tlp'),
        'tlps': json.dumps(static['tlps']),
        'planning': json.dumps(static['planning']),
        'confidences': json.dumps(static['confidences']),
        'motivations': json.dumps(static['motivations']),
        'trustgroups': json.dumps(static['trustgroups']),
        'act_type_list': json.dumps(static['act_type_list']),
        'sophistication': json.dumps(static['sophistication']),
        'intended_effects': json.dumps(static['intended_effects']),
        'draft_id': id,
        'base_template': "act-build.html"
    })
Beispiel #2
0
def incident_view(request, id, edit=False):
    if edit:
        request.breadcrumbs([("Incident Edit", "/incident/edit/")])
        mode = "Edit"
    else:
        request.breadcrumbs([("Incident View", "/incident/build/")])
        mode = "View"

    static = views.get_static(request.user)
    return render(request, 'cert-inc-build.html', {
        'mode': mode,
        'id': id,
        'object_type': "incident",
        'edit_allowed': user_can_edit(request.user, id),
        'effects': json.dumps(static['effects']),
        'statuses': json.dumps(static['statuses']),
        'categories': json.dumps(CATEGORIES),
        'time_types_list': json.dumps(TIME_TYPES),
        'confidences': json.dumps(static['confidences']),
        'tlps': json.dumps(static['tlps']),
        'trustgroups': json.dumps(static['trustgroups']),
        'discovery_methods': json.dumps(static['discovery_methods']),
        'intended_effects': json.dumps(static['intended_effects']),
        'ajax_uri': reverse('incident_ajax'),
        'time_zone': datetime.datetime.now(settings.LOCAL_TZ).tzname()
    })
Beispiel #3
0
def object_details(request, id_):
    edge_obj = load_edge_object_or_404(id_)
    if not rbac.user_has_tlp_access(request.user, edge_obj):
        raise PermissionDenied

    return JsonResponse({
        'allow_edit': rbac.user_can_edit(request.user, edge_obj),
    })