mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-22 10:01:45 +00:00
users: Implement diagnostics
This commit is contained in:
parent
fc00cb6bd9
commit
2ca130b154
14
actions/ldap
14
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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -59,6 +59,9 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<a href="{% url 'diagnostics:module' 'users' %}"
|
||||
class="btn btn-default">Run Diagnostics</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user