mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
Added functions get_uid_by_username
This commit is contained in:
parent
28e2d9c94b
commit
e6a51d02fb
@ -180,3 +180,9 @@ def touch_file(filename):
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.touch()
|
||||
|
||||
def get_uid_by_username(username):
|
||||
try:
|
||||
user_info = pwd.getpwnam(username)
|
||||
return user_info.pw_uid
|
||||
except KeyError:
|
||||
return None
|
||||
|
Loading…
x
Reference in New Issue
Block a user