def setUserDetails(username, name=None, password=None, aliases=None): debugOutput("Setting details for %s name %s password %s" % (username, name, password)) system.updateUser(username, name=name, password=password) if password and username in samba.getUsers(): samba.setPassword(username, password)
def deleteUser(username): # For sanity's sake! if username.lower() in ["root", "administrator"]: return if username in samba.getUsers(): samba.deleteUser(username) system.deleteUser(username)
def onMessage(self, payload, isBinary): if payload == "list-users": # echo back message verbatim # self.sendMessage(payload, isBinary) # print samba users samba = MySambaClass() users = samba.getUsers() self.sendMessage(json.dumps(users)) else: print("Did not understand command")
def getUsers(): sambaUsers = samba.getUsers() systemUsers = system.getUserDetails() users = {} for username in sambaUsers: if username in ["root"]: continue users[username] = systemUsers[username] return users