예제 #1
0
func (u *User) SetLocked(dbusMsg dbus.DMessage, locked bool) (bool, error) {
	pid := dbusMsg.GetSenderPID()
	err := u.accessAuthentication(pid, false, "SetLocked")
	if err != nil {
		return false, err
	}

	go func() {
		err := users.LockedUser(locked, u.UserName)
		if err != nil {
			logger.Warning("DoAction: locked user failed:", err)
			triggerSigErr(pid, "SetLocked", err.Error())
			return
		}

		u.setPropBool(&u.Locked, "Locked", locked)
	}()

	return true, nil
}
예제 #2
0
func (u *User) SetPassword(dbusMsg dbus.DMessage, words string) (bool, error) {
	pid := dbusMsg.GetSenderPID()
	err := u.accessAuthentication(pid, false, "SetPassword")
	if err != nil {
		return false, err
	}

	go func() {
		err := users.ModifyPasswd(words, u.UserName)
		if err != nil {
			logger.Warning("DoAction: modify passwd failed:", err)
			triggerSigErr(pid, "SetPassword", err.Error())
			return
		}

		err = users.LockedUser(false, u.UserName)
		if err != nil {
			logger.Warning("DoAction: unlock user failed:", err)
		}
	}()

	return true, nil
}