mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-20 18:50:17 +03:00
In users.py fixes:
------------------ - misplaced-comparison-constant - expected 2 blank lines - line too long
This commit is contained in:
parent
f09685ee72
commit
54d7f78f71
@ -21,14 +21,16 @@ import logging
|
||||
|
||||
from .logging import slogm
|
||||
|
||||
|
||||
def is_root():
|
||||
'''
|
||||
Check if current process has root permissions.
|
||||
'''
|
||||
if 0 == os.getuid():
|
||||
if os.getuid() == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_process_user():
|
||||
'''
|
||||
Get current process username.
|
||||
@ -40,6 +42,7 @@ def get_process_user():
|
||||
|
||||
return username
|
||||
|
||||
|
||||
def username_match_uid(username):
|
||||
'''
|
||||
Check the passed username matches current process UID.
|
||||
@ -52,6 +55,7 @@ def username_match_uid(username):
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def set_privileges(username, uid, gid, groups=list()):
|
||||
'''
|
||||
Set current process privileges
|
||||
@ -70,7 +74,10 @@ def set_privileges(username, uid, gid, groups=list()):
|
||||
#except Exception as exc:
|
||||
# print('setgroups')
|
||||
|
||||
logging.debug(slogm('Set process permissions to UID {} and GID {} for user {}'.format(uid, gid, username)))
|
||||
logging.debug(
|
||||
slogm('Set process permissions to UID {} and GID {} for user {}'.format(
|
||||
uid, gid, username)))
|
||||
|
||||
|
||||
def with_privileges(username, func):
|
||||
'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user