Commit 4ef1f7d2 authored by Mark Caglienzi's avatar Mark Caglienzi
Browse files

Add, all in one commit, the functionality to show which users have expired...

Add, all in one commit, the functionality to show which users have expired passwords in the user list page. If the performances are too sluggish, just revert this commit. refs #9972
parent 71279af9
......@@ -115,6 +115,8 @@
<th>{% trans "Active" %}</th>
<th>{% trans "Username" %}</th>
<th>{% trans "Full name" %}</th>
{# refs #9972 #}
<th class="hidden-xs hidden-sm">{% trans "Password" %}</th>
<th class="hidden-xs hidden-sm">{% trans "Unit" %}</th>
<th class="hidden-xs hidden-sm">{% trans "Home" %}</th>
<th class="hidden-xs hidden-sm">{% trans "Controller" %}</th>
......
......@@ -74,8 +74,20 @@ class UserListJSON(OctonetMixin, View):
else:
length = 30
# refs #9972
epoch = datetime.date(1970, 1, 1)
today = datetime.date.today()
aaData = []
for u in users[start:start+length]:
# refs #9972
shadowLastChange = int(u.get('shadowLastChange', 0))
shadowMax = int(u.get('shadowMax', 0))
last_password_change = epoch + datetime.timedelta(days=shadowLastChange)
next_password_change = last_password_change + datetime.timedelta(days=shadowMax)
expired_password = shadowLastChange == 0 or next_password_change < today
password_icon_color = expired_password and "text-danger" or "text-success"
row = []
row.append("<span class='glyphicon glyphicon-{}'></span>".format(
u.get("enabled") and "ok text-success" or "remove text-danger"))
......@@ -84,6 +96,8 @@ class UserListJSON(OctonetMixin, View):
html.escape(u.get("uid"))
))
row.append(u.get("gecos"))
# refs #9972
row.append("<span class='fa fa-key {}'></span>".format(password_icon_color))
row.append(u.get("ou"))
row.append(u.get("homeDirectory"))
controller = u.get("controllerGroup")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment