install printer based on GPO
This commit is contained in:
parent
cc4010b1bb
commit
2fe52816e4
31 changed files with 3284 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
|||
import subprocess
|
||||
from linuxmusterLinuxclient7 import logging
|
||||
|
||||
def getGroupsOfLocalUser(username):
|
||||
"""
|
||||
Get all groups of a local user
|
||||
|
||||
:param username: The username of the user
|
||||
:type username: str
|
||||
:return: Tuple (success, list of groups)
|
||||
:rtype: tuple
|
||||
"""
|
||||
try:
|
||||
groups = subprocess.check_output(["id", "-Gnz", username])
|
||||
stringList=[x.decode('utf-8') for x in groups.split(b"\x00")]
|
||||
return True, stringList
|
||||
except Exception as e:
|
||||
logging.warning("Exception when querying groups of user {}, it probaply does not exist".format(username))
|
||||
return False, None
|
Loading…
Add table
Add a link
Reference in a new issue