fix: the webui does not allow to disable the last admin now.
Release / release (push) Failing after 4s
Release / release (push) Failing after 4s
This commit is contained in:
1 parent
5fff009320
commit
ff0c93ed73
10 files changed
+46
-15
No files matched your search
@@ -45,6 +45,10 @@ linux-manager (0.41.0-1) unstable; urgency=medium
|
||||
* The examples switch the router and the VPN on.
|
||||
* A NAT rule that the configuration no longer needs is removed from the
|
||||
running firewall at once, not only at the next boot.
|
||||
* The last enabled member of admins can no longer be disabled, through
|
||||
the API, the Manager or linux-manager-user (409, status 4).
|
||||
* The Users, Groups, Service accounts, Web Sites and Files pages keep a
|
||||
refused change's message above the list after they read it again.
|
||||
* tests/remote/run.py tests the components on Ubuntu 26.04 instances of an
|
||||
LXD remote, and tests/remote/vm.py starts and removes one server
|
||||
VM there to work with, reached through ports 7080, 7081 and 2222 (SSH)
|
||||
|
||||
@@ -765,9 +765,17 @@ def passwd(connection, name, password):
|
||||
|
||||
|
||||
def disable(connection, name):
|
||||
"""Lock the user out; the WireGuard peers of a disabled user are left out of wg0.conf."""
|
||||
"""Lock the user out; the WireGuard peers of a disabled user are left out of wg0.conf.
|
||||
|
||||
The last enabled member of admins is not disabled, so the server keeps an administrator who can sign in;
|
||||
Failure with status 4.
|
||||
"""
|
||||
current = entry(connection, name)
|
||||
if current.get('pwdAccountLockedTime') != [LOCKED]:
|
||||
admins = groups_of(connection, name).get(ADMIN_GROUP)
|
||||
if admins is not None and not any(entry(connection, member).get('pwdAccountLockedTime') != [LOCKED]
|
||||
for member in admins if member != name):
|
||||
raise Failure(f'{name} is the last enabled member of {ADMIN_GROUP} and cannot be disabled', 4)
|
||||
connection.modify_s(dn_of(name), [(ldap.MOD_REPLACE, 'pwdAccountLockedTime', [LOCKED])])
|
||||
if 'linuxManagerWireGuardPeer' in current:
|
||||
apply_wireguard()
|
||||
|
||||
Reference in new issue
Block a user