Revision 6d48c46c flowspec/forms.py
b/flowspec/forms.py | ||
---|---|---|
22 | 22 |
# " e.g.10.10.0.1/32"), label=ugettext_lazy("Destination Address"), required=False) |
23 | 23 |
# destination_ports = forms.ModelMultipleChoiceField(queryset=MatchPort.objects.all(), help_text=ugettext_lazy("A set of destination ports to block"), label=ugettext_lazy("Destination Ports"), required=False) |
24 | 24 |
# ports = forms.ModelMultipleChoiceField(queryset=MatchPort.objects.all(), help_text=ugettext_lazy("A set of ports to block"), label=ugettext_lazy("Ports"), required=False) |
25 |
|
|
25 | 26 |
class Meta: |
26 | 27 |
model = Route |
27 | 28 |
|
... | ... | |
99 | 100 |
raise forms.ValidationError('Once destination port is matched, destination has to be filled as well. Either deselect destination port or fill destination address') |
100 | 101 |
if not (source or sourceports or ports or destination or destinationports): |
101 | 102 |
raise forms.ValidationError('Fill at least a Route Match Condition') |
103 |
if not user.is_superuser and then[0].action not in settings.UI_USER_THEN_ACTIONS: |
|
104 |
raise forms.ValidationError('This action "%s" is not permitted' %(then[0].action)) |
|
102 | 105 |
existing_routes = Route.objects.exclude(status='EXPIRED').exclude(status='PENDING').exclude(status='ERROR').exclude(status='ADMININACTIVE') |
103 | 106 |
existing_routes = existing_routes.filter(applier__userprofile__peer=peer) |
104 | 107 |
if source: |
Also available in: Unified diff