Exemplo n.º 1
0
func (m *Manager) FindUserByName(name string) (string, error) {
	info, err := users.GetUserInfoByName(name)
	if err != nil {
		return "", err
	}

	return m.FindUserById(info.Uid)
}
Exemplo n.º 2
0
func (m *Manager) CreateGuestAccount() (string, error) {
	name, err := users.CreateGuestUser()
	if err != nil {
		return "", err
	}

	info, err := users.GetUserInfoByName(name)
	if err != nil {
		return "", err
	}

	return userDBusPath + info.Uid, nil
}
Exemplo n.º 3
0
/**
 * Copy user resource datas to their home directory
 **/
func CopyUserDatas(user string) {
	info, err := users.GetUserInfoByName(user)
	if err != nil {
		fmt.Printf("Get '%s' info failed: %v\n", user, err)
		return
	}

	lang := getDefaultLang()
	fmt.Println("Current LANG is :", lang)

	err = copyXDGDirConfig(info.Home, lang)
	if err != nil {
		fmt.Printf("Copy xdg config for '%s' failed: %v\n", user, err)
	}

	renameXDGDirs(info.Home, lang)

	err = copyDeepinManuals(info.Home, lang)
	if err != nil {
		fmt.Printf("Copy deepin manuals for '%s' failed: %v\n", user, err)
	}

	err = copySoundThemeData(info.Home, lang)
	if err != nil {
		fmt.Printf("Copy sound theme for '%s' failed: %v\n", user, err)
	}

	err = copyBroswerConfig(info.Home, lang)
	if err != nil {
		fmt.Printf("Copy broswer config for '%s' failed: %v\n", user, err)
	}

	err = changeDirOwner(user, info.Home)
	if err != nil {
		fmt.Printf("Change '%s' ower to '%s' failed: %v\n", info.Home, user, err)
	}
}