File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -203,25 +203,15 @@ def check(s: str) -> bool:
203203 item = self ._item_group .find_by_key (s )
204204 return item .has_value ()
205205
206- def has_superuser () -> bool :
207- if auth_config and auth_config .users :
208- return any ([u .sudo for u in auth_config .users ])
209- return False
210-
211- def has_regular_user () -> bool :
212- if auth_config and auth_config .users :
213- return len (auth_config .users ) > 0
214- return False
215-
216206 missing = set ()
217207
218- if (auth_config is None or auth_config .root_enc_password is None ) and not has_superuser ():
208+ if (auth_config is None or auth_config .root_enc_password is None ) and not ( auth_config and auth_config . has_superuser () ):
219209 missing .add (
220210 tr ('Either root-password or at least 1 user with sudo privileges must be specified' ),
221211 )
222212
223213 # These greeters only show users with UID >= 1000 and have no manual login by default
224- if not has_regular_user ():
214+ if not ( auth_config and auth_config . has_regular_user () ):
225215 profile_item : MenuItem = self ._item_group .find_by_key ('profile_config' )
226216 profile_config : ProfileConfiguration | None = profile_item .value
227217
Original file line number Diff line number Diff line change @@ -82,3 +82,9 @@ def json(self) -> AuthenticationSerialization:
8282 config ['u2f_config' ] = self .u2f_config .json ()
8383
8484 return config
85+
86+ def has_superuser (self ) -> bool :
87+ return any (u .sudo for u in self .users )
88+
89+ def has_regular_user (self ) -> bool :
90+ return len (self .users ) > 0
You can’t perform that action at this time.
0 commit comments