mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Delete posix user when deleting plinth user.
This commit is contained in:
1 parent
f3ea867e07
commit
46dd2225f7
2 files changed
+48
No files matched your search
@@ -19,9 +19,12 @@
|
||||
Plinth module to manage users
|
||||
"""
|
||||
|
||||
from django.db.models.signals import post_delete
|
||||
from django.contrib.auth.models import User
|
||||
from gettext import gettext as _
|
||||
|
||||
from plinth import cfg
|
||||
from plinth import actions
|
||||
|
||||
__all__ = ['init']
|
||||
|
||||
@@ -33,3 +36,14 @@ def init():
|
||||
menu = cfg.main_menu.get('system:index')
|
||||
menu.add_urlname(_('Users and Groups'), 'glyphicon-user', 'users:index',
|
||||
15)
|
||||
|
||||
post_delete.connect(delete_posix_user)
|
||||
|
||||
|
||||
def delete_posix_user(sender, instance=None, **kwargs):
|
||||
try:
|
||||
instance
|
||||
except User.DoesNotExist:
|
||||
pass
|
||||
else:
|
||||
actions.superuser_run('delete-user', [instance.username])
|
||||
Reference in new issue
Block a user