diff --git a/archinstall/lib/global_menu.py b/archinstall/lib/global_menu.py index c6e2bdfc..cae51df2 100644 --- a/archinstall/lib/global_menu.py +++ b/archinstall/lib/global_menu.py @@ -203,25 +203,15 @@ class GlobalMenu(AbstractMenu[None]): item = self._item_group.find_by_key(s) return item.has_value() - def has_superuser() -> bool: - if auth_config and auth_config.users: - return any([u.sudo for u in auth_config.users]) - return False - - def has_regular_user() -> bool: - if auth_config and auth_config.users: - return len(auth_config.users) > 0 - return False - missing = set() - if (auth_config is None or auth_config.root_enc_password is None) and not has_superuser(): + if (auth_config is None or auth_config.root_enc_password is None) and not (auth_config and auth_config.has_superuser()): missing.add( tr('Either root-password or at least 1 user with sudo privileges must be specified'), ) # These greeters only show users with UID >= 1000 and have no manual login by default - if not has_regular_user(): + if not (auth_config and auth_config.has_regular_user()): profile_item: MenuItem = self._item_group.find_by_key('profile_config') profile_config: ProfileConfiguration | None = profile_item.value diff --git a/archinstall/lib/models/authentication.py b/archinstall/lib/models/authentication.py index ebbf7050..51120479 100644 --- a/archinstall/lib/models/authentication.py +++ b/archinstall/lib/models/authentication.py @@ -82,3 +82,9 @@ class AuthenticationConfiguration: config['u2f_config'] = self.u2f_config.json() return config + + def has_superuser(self) -> bool: + return any(u.sudo for u in self.users) + + def has_regular_user(self) -> bool: + return len(self.users) > 0