ConsoleUser

Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com

This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.

All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.

class LinuxLoginManager.LinuxLoginManager(system, config)

The login process on many Linux systems is faily similar, so this provides a home for the common portions of the process.

can_login()

Try to determine whether or not a user could login if told to do so right now. This is different from is_logged_in because it will also check for the screen being locked or similar other situations.

It is possible that this method will “disturb” the remote system by moving the mouse or other actions which could interfere with a running ConsoleUser or human at the console.

Return: a value < 0 on error, 0 if a user could login, 1 if there is already a user logged in, 2 if the screen is locked, or 3 if the state cannot be determined (e.g., the Please Wait dialog is showing)

login()

Assuming no user is currently logged in, login with the config credentials this instance was created with. If a user is already logged in this method does nothing (aside from possiibly changing GUI elements like moving the mouse).

Return: True if a user is logged in when the function returns