login1

package
v22.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 9

Documentation

Overview

Package login1 provides integration with the systemd logind API. See http://www.freedesktop.org/wiki/Software/systemd/logind/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is a connection to systemds dbus endpoint.

func New

func New() (*Conn, error)

New establishes a connection to the system bus and authenticates.

func (*Conn) Close

func (c *Conn) Close()

Close closes the dbus connection

func (*Conn) Connected added in v22.4.0

func (c *Conn) Connected() bool

Connected returns whether conn is connected

func (*Conn) GetActiveSession added in v22.1.0

func (c *Conn) GetActiveSession() (dbus.ObjectPath, error)

GetActiveSession may be used to get the session object path for the current active session

func (*Conn) GetSession

func (c *Conn) GetSession(id string) (dbus.ObjectPath, error)

GetSession may be used to get the session object path for the session with the specified ID.

func (*Conn) GetSessionDisplay added in v22.1.0

func (c *Conn) GetSessionDisplay(sessionPath dbus.ObjectPath) (string, error)

GetSessionDisplay may be used to get the display for specific session

func (*Conn) GetSessionPropertiesContext added in v22.4.0

func (c *Conn) GetSessionPropertiesContext(ctx context.Context, sessionPath dbus.ObjectPath) (map[string]dbus.Variant, error)

GetSessionPropertiesContext takes a session path and returns all of its dbus object properties.

func (*Conn) GetSessionPropertyContext added in v22.4.0

func (c *Conn) GetSessionPropertyContext(ctx context.Context, sessionPath dbus.ObjectPath, property string) (*dbus.Variant, error)

GetSessionPropertyContext takes a session path and a property name and returns the property value.

func (*Conn) GetSessionUser added in v22.1.0

func (c *Conn) GetSessionUser(sessionPath dbus.ObjectPath) (*User, error)

GetSessionUser may be used to get the user of specific session

func (*Conn) GetUserPropertiesContext added in v22.4.0

func (c *Conn) GetUserPropertiesContext(ctx context.Context, userPath dbus.ObjectPath) (map[string]dbus.Variant, error)

GetUserPropertiesContext takes a user path and returns all of its dbus object properties.

func (*Conn) GetUserPropertyContext added in v22.4.0

func (c *Conn) GetUserPropertyContext(ctx context.Context, userPath dbus.ObjectPath, property string) (*dbus.Variant, error)

GetUserPropertyContext takes a user path and a property name and returns the property value.

func (*Conn) Inhibit

func (c *Conn) Inhibit(what, who, why, mode string) (*os.File, error)

Inhibit takes inhibition lock in logind.

func (*Conn) ListSessions deprecated

func (c *Conn) ListSessions() ([]Session, error)

Deprecated: use ListSessionsContext instead.

func (*Conn) ListSessionsContext added in v22.4.0

func (c *Conn) ListSessionsContext(ctx context.Context) ([]Session, error)

ListSessionsContext returns an array with all current sessions.

func (*Conn) ListUsers deprecated

func (c *Conn) ListUsers() ([]User, error)

Deprecated: use ListUsersContext instead.

func (*Conn) ListUsersContext added in v22.4.0

func (c *Conn) ListUsersContext(ctx context.Context) ([]User, error)

ListUsersContext returns an array with all currently logged-in users.

func (*Conn) LockSession

func (c *Conn) LockSession(id string)

LockSession asks the session with the specified ID to activate the screen lock.

func (*Conn) LockSessions

func (c *Conn) LockSessions()

LockSessions asks all sessions to activate the screen locks. This may be used to lock any access to the machine in one action.

func (*Conn) PowerOff

func (c *Conn) PowerOff(askForAuth bool)

PowerOff asks logind for a power off optionally asking for auth.

func (*Conn) Reboot

func (c *Conn) Reboot(askForAuth bool)

Reboot asks logind for a reboot optionally asking for auth.

func (*Conn) Subscribe

func (c *Conn) Subscribe(members ...string) chan *dbus.Signal

Subscribe to signals on the logind dbus

func (*Conn) TerminateSession

func (c *Conn) TerminateSession(id string)

TerminateSession forcibly terminate one specific session.

func (*Conn) TerminateUser

func (c *Conn) TerminateUser(uid uint32)

TerminateUser forcibly terminates all processes of a user.

type Session

type Session struct {
	ID   string
	UID  uint32
	User string
	Seat string
	Path dbus.ObjectPath
}

Session object definition.

type User

type User struct {
	UID  uint32
	Name string
	Path dbus.ObjectPath
}

User object definition.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL