accounts

package
v0.0.0-...-c5429dd Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tr

func Tr(text string) string

Types

type Daemon

type Daemon struct {
	*loader.ModuleBase
	// contains filtered or unexported fields
}

func NewDaemon

func NewDaemon() *Daemon

func (*Daemon) GetDependencies

func (*Daemon) GetDependencies() []string

func (*Daemon) Start

func (d *Daemon) Start() error

func (*Daemon) Stop

func (d *Daemon) Stop() error

type DefaultDomainUserConfig

type DefaultDomainUserConfig map[string]*domainUserConfig

type ErrCodeType

type ErrCodeType int32
const (
	// 未知错误
	ErrCodeUnkown ErrCodeType = iota
	// 权限认证失败
	ErrCodeAuthFailed
	// 执行命令失败
	ErrCodeExecFailed
	// 传入的参数不合法
	ErrCodeParamInvalid
)

func (ErrCodeType) String

func (code ErrCodeType) String() string

type ErrInvalidBackground

type ErrInvalidBackground struct {
	FileName string
}

func (ErrInvalidBackground) Error

func (err ErrInvalidBackground) Error() string

type ExpiredStatus

type ExpiredStatus int

type ImageBlur

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

func (*ImageBlur) Delete

func (ib *ImageBlur) Delete(file string) *dbus.Error

func (*ImageBlur) Get

func (ib *ImageBlur) Get(file string) (blurred string, busErr *dbus.Error)

func (*ImageBlur) GetExportedMethods

func (v *ImageBlur) GetExportedMethods() dbusutil.ExportedMethods

func (*ImageBlur) GetInterfaceName

func (ib *ImageBlur) GetInterfaceName() string

type InterfaceConfig

type InterfaceConfig struct {
	Service   string `json:"service"`
	Path      string `json:"path"`
	Interface string `json:"interface"`
}

type LoginReminderInfo

type LoginReminderInfo struct {
	Username string
	Spent    struct {
		LastChange int
		Min        int
		Max        int
		Warn       int
		Inactive   int
		Expire     int
	}
	CurrentLogin            LoginUtmpx
	LastLogin               LoginUtmpx
	FailCountSinceLastLogin int
}

type LoginUtmpx

type LoginUtmpx struct {
	InittabID string
	Line      string
	Host      string
	Address   string
	Time      string
}

type Manager

type Manager struct {
	PropsMu sync.RWMutex

	UserList   []string
	UserListMu sync.RWMutex

	// dbusutil-gen: ignore
	GuestIcon  string
	AllowGuest bool
	// dbusutil-gen: equal=isStrvEqual
	GroupList []string

	IsTerminalLocked bool
	// 快速登录总开关
	QuickLoginEnabled bool
	// contains filtered or unexported fields
}

func NewManager

func NewManager(service *dbusutil.Service) *Manager

func (*Manager) AllowGuestAccount

func (m *Manager) AllowGuestAccount(sender dbus.Sender, allow bool) *dbus.Error

func (*Manager) CreateGroup

func (m *Manager) CreateGroup(sender dbus.Sender, groupName string, gid uint32, isSystem bool) *dbus.Error

func (*Manager) CreateGuestAccount

func (m *Manager) CreateGuestAccount(sender dbus.Sender) (user string, busErr *dbus.Error)

func (*Manager) CreateUser

func (m *Manager) CreateUser(sender dbus.Sender,
	name, fullName string, accountType int32) (userPath dbus.ObjectPath, busErr *dbus.Error)

func (*Manager) DeleteGroup

func (m *Manager) DeleteGroup(sender dbus.Sender, groupName string, force bool) *dbus.Error

func (*Manager) DeleteUser

func (m *Manager) DeleteUser(sender dbus.Sender,
	name string, rmFiles bool) *dbus.Error

Delete a exist user.

name: 用户名

rmFiles: 是否删除用户数据

func (*Manager) EnablePasswdChangedHandler

func (m *Manager) EnablePasswdChangedHandler(sender dbus.Sender, enable bool) *dbus.Error

是否使能accounts服务在监听到/etc/passwd文件变化后,执行对应的属性更新和服务导出,只允许root用户操作该接口

func (*Manager) FindUserById

func (m *Manager) FindUserById(uid string) (user string, busErr *dbus.Error)

func (*Manager) FindUserByName

func (m *Manager) FindUserByName(name string) (user string, busErr *dbus.Error)

func (*Manager) GetExportedMethods

func (v *Manager) GetExportedMethods() dbusutil.ExportedMethods

func (*Manager) GetGroupInfoByName

func (m *Manager) GetGroupInfoByName(name string) (groupInfo string, busErr *dbus.Error)

func (*Manager) GetGroups

func (m *Manager) GetGroups() (groups []string, busErr *dbus.Error)

func (*Manager) GetInterfaceName

func (*Manager) GetInterfaceName() string

func (*Manager) GetPresetGroups

func (m *Manager) GetPresetGroups(accountType int32) (groups []string, busErr *dbus.Error)

func (*Manager) IsPasswordValid

func (m *Manager) IsPasswordValid(password string) (valid bool, msg string, code int32, busErr *dbus.Error)

检测密码是否有效

ret0: 是否合法

ret1: 提示信息

ret2: 不合法代码

func (*Manager) IsUsernameValid

func (m *Manager) IsUsernameValid(sender dbus.Sender, name string) (valid bool,
	msg string, code int32, busErr *dbus.Error)

检查用户名是否有效

ret0: 是否合法

ret1: 不合法原因

ret2: 不合法代码

func (*Manager) ModifyGroup

func (m *Manager) ModifyGroup(sender dbus.Sender, currentGroupName string, newGroupName string, newGID uint32) *dbus.Error

func (*Manager) RandUserIcon

func (m *Manager) RandUserIcon() (iconFile string, busErr *dbus.Error)

随机得到一个用户头像

ret0:头像路径,为空则表示获取失败

func (*Manager) SetTerminalLocked

func (m *Manager) SetTerminalLocked(sender dbus.Sender, locked bool) *dbus.Error

type User

type User struct {
	PropsMu sync.RWMutex

	UserName        string
	UUID            string
	FullName        string
	Uid             string
	Gid             string
	HomeDir         string
	Shell           string
	Locale          string
	Layout          string
	IconFile        string
	PasswordHint    string
	Use24HourFormat bool
	WeekdayFormat   int32
	ShortDateFormat int32
	LongDateFormat  int32
	ShortTimeFormat int32
	LongTimeFormat  int32
	WeekBegins      int32

	// dbusutil-gen: equal=nil
	DesktopBackgrounds []string
	// dbusutil-gen: equal=isStrvEqual
	Groups            []string
	GreeterBackground string
	XSession          string

	PasswordStatus     string
	MaxPasswordAge     int32
	PasswordLastChange int32
	// 用户是否被禁用
	Locked bool
	// 是否允许此用户自动登录
	AutomaticLogin bool

	// 是否快速登录
	QuickLogin bool

	// 当前工作区
	Workspace int32

	// deprecated property
	SystemAccount bool

	NoPasswdLogin bool

	AccountType int32
	LoginTime   uint64
	CreatedTime uint64

	// dbusutil-gen: equal=nil
	IconList []string
	// dbusutil-gen: equal=nil
	HistoryLayout []string

	WechatAuthEnabled bool
	// contains filtered or unexported fields
}

func NewDomainUser

func NewDomainUser(usrId uint32, service *dbusutil.Service, groups []string) (*User, error)

func NewUser

func NewUser(userPath string, service *dbusutil.Service, ignoreErr bool) (*User, error)

func (*User) AddGroup

func (u *User) AddGroup(sender dbus.Sender, group string) *dbus.Error

func (*User) DeleteGroup

func (u *User) DeleteGroup(sender dbus.Sender, group string) *dbus.Error

func (*User) DeleteIconFile

func (u *User) DeleteIconFile(sender dbus.Sender, icon string) *dbus.Error

只能删除不是用户当前图标的自定义图标

func (*User) DeleteSecretKey

func (u *User) DeleteSecretKey(sender dbus.Sender) *dbus.Error

func (*User) EnableNoPasswdLogin

func (u *User) EnableNoPasswdLogin(sender dbus.Sender, enabled bool) *dbus.Error

func (*User) EnableWechatAuth

func (u *User) EnableWechatAuth(sender dbus.Sender, value bool) *dbus.Error

func (*User) GetExportedMethods

func (v *User) GetExportedMethods() dbusutil.ExportedMethods

func (*User) GetInterfaceName

func (*User) GetInterfaceName() string

func (*User) GetLargeIcon

func (u *User) GetLargeIcon() string

获取当前头像的大图标

func (*User) GetReminderInfo

func (u *User) GetReminderInfo() (info LoginReminderInfo, dbusErr *dbus.Error)

func (*User) GetSecretKey

func (u *User) GetSecretKey(sender dbus.Sender, username string) (string, *dbus.Error)

func (*User) GetSecretQuestions

func (u *User) GetSecretQuestions() (list []int, err *dbus.Error)

func (*User) IsIconDeletable

func (u *User) IsIconDeletable(iconURI string) bool

func (*User) IsPasswordExpired

func (u *User) IsPasswordExpired() (bool, *dbus.Error)

func (*User) PasswordExpiredInfo

func (u *User) PasswordExpiredInfo() (expiredStatus ExpiredStatus, dayLeft int64, busErr *dbus.Error)

func (*User) SetAutomaticLogin

func (u *User) SetAutomaticLogin(sender dbus.Sender, enabled bool) *dbus.Error

func (*User) SetCurrentWorkspace

func (u *User) SetCurrentWorkspace(sender dbus.Sender, currentWorkspace int32) *dbus.Error

记录当前工作区,登录时前端从记录文件中获取当前工作区以及相应的桌面背景

func (*User) SetDesktopBackgrounds

func (u *User) SetDesktopBackgrounds(sender dbus.Sender, val []string) *dbus.Error

func (*User) SetFullName

func (u *User) SetFullName(sender dbus.Sender, name string) *dbus.Error

func (*User) SetGreeterBackground

func (u *User) SetGreeterBackground(sender dbus.Sender, bg string) *dbus.Error

func (*User) SetGroups

func (u *User) SetGroups(sender dbus.Sender, groups []string) *dbus.Error

func (*User) SetHistoryLayout

func (u *User) SetHistoryLayout(sender dbus.Sender, list []string) *dbus.Error

func (*User) SetHomeDir

func (u *User) SetHomeDir(sender dbus.Sender, home string) *dbus.Error

func (*User) SetIconFile

func (u *User) SetIconFile(sender dbus.Sender, iconURI string) *dbus.Error

func (*User) SetLayout

func (u *User) SetLayout(sender dbus.Sender, layout string) *dbus.Error

func (*User) SetLocale

func (u *User) SetLocale(sender dbus.Sender, locale string) *dbus.Error

func (*User) SetLocked

func (u *User) SetLocked(sender dbus.Sender, locked bool) *dbus.Error

func (*User) SetLongDateFormat

func (u *User) SetLongDateFormat(sender dbus.Sender, value int32) *dbus.Error

func (*User) SetLongTimeFormat

func (u *User) SetLongTimeFormat(sender dbus.Sender, value int32) *dbus.Error

func (*User) SetMaxPasswordAge

func (u *User) SetMaxPasswordAge(sender dbus.Sender, nDays int32) *dbus.Error

func (*User) SetPassword

func (u *User) SetPassword(sender dbus.Sender, password string) *dbus.Error

func (*User) SetPasswordHint

func (u *User) SetPasswordHint(hint string) (busErr *dbus.Error)

func (*User) SetQuickLogin

func (u *User) SetQuickLogin(sender dbus.Sender, enabled bool) *dbus.Error

设置用户是否快速登录

func (*User) SetSecretKey

func (u *User) SetSecretKey(sender dbus.Sender, secretKey string) *dbus.Error

func (*User) SetSecretQuestions

func (u *User) SetSecretQuestions(sender dbus.Sender, list map[int][]byte) *dbus.Error

func (*User) SetShell

func (u *User) SetShell(sender dbus.Sender, shell string) *dbus.Error

func (*User) SetShortDateFormat

func (u *User) SetShortDateFormat(sender dbus.Sender, value int32) *dbus.Error

func (*User) SetShortTimeFormat

func (u *User) SetShortTimeFormat(sender dbus.Sender, value int32) *dbus.Error

func (*User) SetUse24HourFormat

func (u *User) SetUse24HourFormat(sender dbus.Sender, value bool) *dbus.Error

func (*User) SetWeekBegins

func (u *User) SetWeekBegins(sender dbus.Sender, value int32) *dbus.Error

func (*User) SetWeekdayFormat

func (u *User) SetWeekdayFormat(sender dbus.Sender, value int32) *dbus.Error

func (*User) UpdateWechatAuthState

func (u *User) UpdateWechatAuthState() *dbus.Error

func (*User) VerifySecretQuestions

func (u *User) VerifySecretQuestions(answers map[int]string) (failed []int, err *dbus.Error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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