diff --git a/actions/ldap b/actions/ldap index cf0dc75eb..fd06bce54 100755 --- a/actions/ldap +++ b/actions/ldap @@ -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 diff --git a/plinth/modules/users/__init__.py b/plinth/modules/users/__init__.py index 6a68e6bac..45b7a9906 100644 --- a/plinth/modules/users/__init__.py +++ b/plinth/modules/users/__init__.py @@ -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) diff --git a/plinth/modules/users/templates/users_list.html b/plinth/modules/users/templates/users_list.html index f4040c66e..29933d5aa 100644 --- a/plinth/modules/users/templates/users_list.html +++ b/plinth/modules/users/templates/users_list.html @@ -59,6 +59,9 @@ {% endfor %} + + Run Diagnostics