users: Implement diagnostics

This commit is contained in:
Sunil Mohan Adapa 2015-07-28 20:05:06 +05:30
parent fc00cb6bd9
commit 2ca130b154
3 changed files with 25 additions and 2 deletions

View File

@ -121,6 +121,17 @@ remove_user_from_group()
}
diagnose()
{
result="failed"
if lsldap | grep 'dn: dc=thisbox' > /dev/null; then
result="passed"
fi
echo "[[\"Access LDAP server locally\", \"$result\"]]"
}
setup()
{
# XXX: Password setting on users is disabled as changing passwords
@ -163,6 +174,9 @@ case $command in
remove-user-from-group)
remove_user_from_group "$@"
;;
diagnose)
diagnose "$@"
;;
*)
echo "Invalid sub-command"
exit -1

View File

@ -20,10 +20,10 @@ Plinth module to manage users
"""
from gettext import gettext as _
import json
from plinth import cfg
__all__ = ['init']
from plinth import actions
depends = ['plinth.modules.system']
@ -33,3 +33,9 @@ def init():
menu = cfg.main_menu.get('system:index')
menu.add_urlname(_('Users and Groups'), 'glyphicon-user', 'users:index',
15)
def diagnose():
"""Run diagnostics and result the results."""
output = actions.superuser_run('ldap', ['diagnose'])
return json.loads(output)

View File

@ -59,6 +59,9 @@
</div>
{% endfor %}
</div>
<a href="{% url 'diagnostics:module' 'users' %}"
class="btn btn-default">Run Diagnostics</a>
</div>
</div>