Skip to content

Commit

Permalink
remove ip blocks (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdzim authored and D3f0 committed Sep 12, 2018
1 parent 8710c6a commit 8b8f979
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 121 deletions.

This file was deleted.

4 changes: 0 additions & 4 deletions django/apps/blue_management/blue_mgnt/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{% block body_classes %}settings {{ block.super }}{% endblock body_classes %}
{% block breadcrumb %}<a href="{% url 'blue_mgnt:manage' %}">Back to Manage</a>{% endblock breadcrumb %}
{% block modal_options %}
{% include "partials/add-ip-blocks-widget.html" with active="manage" %}
{% include "partials/reboot-widget.html" %}
{% endblock modal_options %}
{% block navtab %}{% include "partials/navtab-widget.html" with active="manage" %}{% endblock navtab %}
Expand All @@ -24,9 +23,6 @@ <h2 class="page-header"><i class="ss-icon">&#x2699;</i>Status
<!-- Settings -->
<h1 class="page-header">
<i class="ss-icon">&#x1F464;</i> Accounts
<div class="actions">
<button id="add-widget" class="button button-primary-basic">Add IP Blocks</button>
</div>
</h1>
<div class="spacer"></div>
{% if saved %}
Expand Down
26 changes: 0 additions & 26 deletions django/apps/blue_management/blue_mgnt/views/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,6 @@ def save_settings(request, api, options):
subprocess.call(['timedatectl', 'set-timezone', cleaned_data['timezone']])


class IPBlockForm(forms.Form):
ip_block = forms.CharField(max_length=43, label='IP Block:')

def clean_ip_block(self):
data = self.cleaned_data['ip_block']
try:
ip = IP(data) # NOQA
except ValueError:
raise forms.ValidationError('Invalid IP Block')
return data


def login_test(config, username, password):
if username:
if account_mgr.authenticator(config, username, password, False):
Expand Down Expand Up @@ -192,23 +180,10 @@ def clean(self):
api.update_enterprise_settings(dict(signup_network_restriction=blocks))
log_admin_action(request, 'update signup network restrictions: %s' % blocks)

IPBlockFormSet = formset_factory(IPBlockForm,
can_delete=True,
formset=BaseIPBlockFormSet)

ip_blocks = IPBlockFormSet(initial=[dict(ip_block=x) for x in
opts['signup_network_restriction']],
prefix='ip_blocks')
error = False
command_output = ''

if request.method == 'POST' and request.user.has_perm('blue_mgnt.can_manage_settings'):
if request.POST.get('form', '') == 'ip_block':
ip_blocks = IPBlockFormSet(request.POST, prefix='ip_blocks')
if ip_blocks.is_valid():
return redirect('blue_mgnt:settings_saved')
else:
error = True
elif request.POST.get('form', '') == 'reboot':
log_admin_action(request, 'reboot management vm')
subprocess.call(['shutdown', '-r', 'now'])
Expand Down Expand Up @@ -253,7 +228,6 @@ def clean(self):
user=request.user,
username=username,
features=features,
ip_blocks=ip_blocks,
command_output=command_output,
options=options,
saved=saved,
Expand Down

0 comments on commit 8b8f979

Please sign in to comment.