cleanup
This commit is contained in:
@@ -1,14 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
|
||||||
Get users that are allowed to log in graphically.
|
|
||||||
|
|
||||||
Criteria for a user to be considered a "graphical login" user:
|
|
||||||
1. UID >= 1000 (regular user, not a system account)
|
|
||||||
2. Has a valid login shell (not /sbin/nologin, /bin/false, etc.)
|
|
||||||
3. Has a home directory that exists
|
|
||||||
|
|
||||||
Output: JSON array of user objects with username, uid, home, shell, and face (avatar path)
|
|
||||||
"""
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
@@ -74,7 +64,7 @@ def main():
|
|||||||
"uid": pw.pw_uid,
|
"uid": pw.pw_uid,
|
||||||
"home": pw.pw_dir,
|
"home": pw.pw_dir,
|
||||||
"shell": pw.pw_shell,
|
"shell": pw.pw_shell,
|
||||||
"gecos": pw.pw_gecos.split(",")[0] if pw.pw_gecos else "", # Full name from GECOS field
|
"gecos": pw.pw_gecos.split(",")[0] if pw.pw_gecos else "",
|
||||||
"face": get_face_path(pw.pw_dir, pw.pw_name),
|
"face": get_face_path(pw.pw_dir, pw.pw_name),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user