Skip to content
Snippets Groups Projects
Commit 2ab297ce authored by Tomáš Čejka's avatar Tomáš Čejka
Browse files

rule expiration: make max date configurable using settings.MAX_RULE_EXPIRE_DAYS

parent a62bb477
Branches
Tags my_prenew_tomas mytomas
No related merge requests found
...@@ -277,8 +277,10 @@ def add_route(request): ...@@ -277,8 +277,10 @@ def add_route(request):
if not request.user.is_superuser: if not request.user.is_superuser:
form.fields['then'] = forms.ModelMultipleChoiceField(queryset=ThenAction.objects.filter(action__in=settings.UI_USER_THEN_ACTIONS).order_by('action'), required=True) form.fields['then'] = forms.ModelMultipleChoiceField(queryset=ThenAction.objects.filter(action__in=settings.UI_USER_THEN_ACTIONS).order_by('action'), required=True)
form.fields['protocol'] = forms.ModelMultipleChoiceField(queryset=MatchProtocol.objects.filter(protocol__in=settings.UI_USER_PROTOCOLS).order_by('protocol'), required=False) form.fields['protocol'] = forms.ModelMultipleChoiceField(queryset=MatchProtocol.objects.filter(protocol__in=settings.UI_USER_PROTOCOLS).order_by('protocol'), required=False)
return render_to_response('apply.html', {'form': form, 'applier': applier}, return render_to_response('apply.html', {'form': form,
context_instance=RequestContext(request)) 'applier': applier,
'maxexpires': settings.MAX_RULE_EXPIRE_DAYS },
context_instance=RequestContext(request))
else: else:
request_data = request.POST.copy() request_data = request.POST.copy()
...@@ -319,8 +321,8 @@ def add_route(request): ...@@ -319,8 +321,8 @@ def add_route(request):
'apply.html', 'apply.html',
{ {
'form': form, 'form': form,
'applier': applier 'applier': applier,
'maxexpires': settings.MAX_RULE_EXPIRE_DAYS
} }
) )
...@@ -401,7 +403,8 @@ def edit_route(request, route_slug): ...@@ -401,7 +403,8 @@ def edit_route(request, route_slug):
{ {
'form': form, 'form': form,
'edit': True, 'edit': True,
'applier': applier 'applier': applier,
'maxexpires': settings.MAX_RULE_EXPIRE_DAYS
}, },
context_instance=RequestContext(request) context_instance=RequestContext(request)
) )
...@@ -425,7 +428,8 @@ def edit_route(request, route_slug): ...@@ -425,7 +428,8 @@ def edit_route(request, route_slug):
{ {
'form': form, 'form': form,
'edit': True, 'edit': True,
'applier': applier 'applier': applier,
'maxexpires': settings.MAX_RULE_EXPIRE_DAYS
}, },
context_instance=RequestContext(request) context_instance=RequestContext(request)
) )
......
...@@ -273,6 +273,8 @@ CELERY_IMPORTS = ("flowspec.tasks", ) ...@@ -273,6 +273,8 @@ CELERY_IMPORTS = ("flowspec.tasks", )
SERVER_EMAIL = "Example FoD Service <noreply@example.com>" SERVER_EMAIL = "Example FoD Service <noreply@example.com>"
EMAIL_SUBJECT_PREFIX = "[FoD] " EMAIL_SUBJECT_PREFIX = "[FoD] "
EXPIRATION_NOTIFY_DAYS = 4 EXPIRATION_NOTIFY_DAYS = 4
# max number of days into the future that is allowed to pick in rule expiration datepicker
MAX_RULE_EXPIRE_DAYS = 30
PREFIX_LENGTH = 29 PREFIX_LENGTH = 29
# Shibboleth # Shibboleth
......
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
$('#id_expires').datepicker({ $('#id_expires').datepicker({
startDate: '+1d', startDate: '+1d',
endDate: '+10d' endDate: '+{{maxexpires}}d'
}); });
$('#setFromAll').click(function(){ $('#setFromAll').click(function(){
$("#id_source").val('0.0.0.0/0'); $("#id_source").val('0.0.0.0/0');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment