Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FoD
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Schmitz
FoD
Commits
2ab297ce
Commit
2ab297ce
authored
7 years ago
by
Tomáš Čejka
Browse files
Options
Downloads
Patches
Plain Diff
rule expiration: make max date configurable using settings.MAX_RULE_EXPIRE_DAYS
parent
a62bb477
Branches
Branches containing commit
Tags
my_prenew_tomas
mytomas
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
flowspec/views.py
+10
-6
10 additions, 6 deletions
flowspec/views.py
flowspy/settings.py.dist
+2
-0
2 additions, 0 deletions
flowspy/settings.py.dist
templates/apply.html
+1
-1
1 addition, 1 deletion
templates/apply.html
with
13 additions
and
7 deletions
flowspec/views.py
+
10
−
6
View file @
2ab297ce
...
@@ -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
)
)
)
...
...
This diff is collapsed.
Click to expand it.
flowspy/settings.py.dist
+
2
−
0
View file @
2ab297ce
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
templates/apply.html
+
1
−
1
View file @
2ab297ce
...
@@ -94,7 +94,7 @@
...
@@ -94,7 +94,7 @@
$
(
'
#id_expires
'
).
datepicker
({
$
(
'
#id_expires
'
).
datepicker
({
startDate
:
'
+1d
'
,
startDate
:
'
+1d
'
,
endDate
:
'
+
10
d
'
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
'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment