diff --git a/app/hr/templates/hr/blacklist/blacklist.html b/app/hr/templates/hr/blacklist/blacklist.html
index 4a34ca8..6dec82f 100644
--- a/app/hr/templates/hr/blacklist/blacklist.html
+++ b/app/hr/templates/hr/blacklist/blacklist.html
@@ -3,24 +3,30 @@
{% block title %}Blacklist User{% endblock %}
{% block content %}
-
Add Blacklist
+
This form will blacklist the listed user below. It'll process all entries for the user and blacklist the following:
-- EVE API Keys
-- Characters
-- Email Addresses
-{% if "reddit"|installed %}
-- Reddit Accounts
-{% endif %}
+ - EVE API Keys
+ - Characters
+ - Email Addresses
+ {% if "reddit"|installed %}- Reddit Accounts
{% endif %}
{% endblock %}
diff --git a/app/hr/templates/hr/blacklist_list.html b/app/hr/templates/hr/blacklist_list.html
index c9ac57a..1bf8656 100644
--- a/app/hr/templates/hr/blacklist_list.html
+++ b/app/hr/templates/hr/blacklist_list.html
@@ -36,7 +36,7 @@
diff --git a/app/hr/views.py b/app/hr/views.py
index 036397d..18dc678 100644
--- a/app/hr/views.py
+++ b/app/hr/views.py
@@ -344,6 +344,12 @@ class HrBlacklistUser(FormView):
def blacklist_item(self, type, value):
Blacklist(type=type, value=value, level=self.level, source=self.source, expiry_date=self.expiry, created_by=self.request.user, reason=self.reason).save()
+ def get_form(self, form_class):
+ obj = form_class()
+ if not (self.request.user.has_perm('auth.change_user') and self.request.user.has_perm('sso.delete_serviceaccount')):
+ obj.fields['disable'].widget.attrs['readonly'] = True
+ return obj
+
def form_valid(self, form):
self.source = BlacklistSource.objects.get(id=1)
self.expiry = form.cleaned_data.get('expiry_date', None)
@@ -371,7 +377,7 @@ class HrBlacklistUser(FormView):
messages.add_message(self.request, messages.INFO, "User %s has been blacklisted" % self.blacklist_user.username )
# Disable the account if requested
- if form.cleaned_data.get('disable', None):
+ if form.cleaned_data.get('disable', None) and self.request.user.has_perm('auth.change_user') and self.request.user.has_perm('sso.delete_serviceaccount'):
self.blacklist_user.active = False
self.blacklist_user.save()
messages.add_message(self.request, messages.INFO, "User %s disabled" % self.blacklist_user.username)