lib.user #
fn by_name #
fn by_name(username string) User
by_name gets the users /etc/passwd data by username
fn by_uid #
fn by_uid(uid int) User
by_uid gets the users /etc/passwd data by user id
fn current #
fn current() string
fn dir_bin #
fn dir_bin(username string) ?string
dir_bin gets the user bin folder
fn dir_config #
fn dir_config(username string) ?string
dir_config gets the user config folder
fn has_home #
fn has_home(username string) bool
has_home checks if the username has a home directory according to /etc/passwd
fn in_group #
fn in_group(username string, group_name string) bool
in_group checks if the user has given group privliages
fn is_root #
fn is_root() bool
is_root return true if current user is efectively root
fn is_user #
fn is_user(username string) bool
fn name_by_uid #
fn name_by_uid(uid int) string
name_by_uid gets the users username from uid
fn uid_by_name #
fn uid_by_name(username string) int
uid_by_name gets the username from uid
fn users #
fn users() Users
users returns users. all data passwd and group
type Users #
type Users = []User
struct User #
struct User {
pub:
username string
password string
uid int
gid int
shell string
dir_home string // home directory for the user account
gecos string
mut:
groups []string
}