func (s *IdentityService) UpsertUser(user services.User) error {

	if !cstrings.IsValidUnixUser(user.GetName()) {
		return trace.BadParameter("'%v is not a valid unix username'", user.GetName())
	}

	for _, l := range user.GetAllowedLogins() {
		if !cstrings.IsValidUnixUser(l) {
			return trace.BadParameter("'%v is not a valid unix username'", l)
		}
	}
	for _, i := range user.GetIdentities() {
		if err := i.Check(); err != nil {
			return trace.Wrap(err)
		}
	}
	data, err := json.Marshal(user)
	if err != nil {
		return trace.Wrap(err)
	}

	err = s.backend.UpsertVal([]string{"web", "users", user.GetName()}, "params", []byte(data), backend.Forever)
	if err != nil {
		return trace.Wrap(err)
	}
	return nil
}
// UpsertUser updates parameters about user
UpsertUser updates parameters about user
// UpsertUser updates parameters about user
func (s *IdentityService) UpsertUser(user services.User) error {
	if !cstrings.IsValidUnixUser(user.GetName()) {
		return trace.BadParameter("'%v is not a valid unix username'", user.GetName())
	}
	for _, l := range user.GetAllowedLogins() {
		if !cstrings.IsValidUnixUser(l) {
			return trace.BadParameter("'%v is not a valid unix username'", l)
		}
	}
	for _, i := range user.GetIdentities() {
		if err := i.Check(); err != nil {
			return trace.Wrap(err)
		}
	}
	data, err := json.Marshal(user)
	if err != nil {
		return trace.Wrap(err)
	}
	err = s.backend.UpsertVal([]string{"web", "users", user.GetName()}, "params", []byte(data), backend.Forever)
	if err != nil {
		return trace.Wrap(err)
	}
	return nil
}
func ( s * IdentityService ) UpsertUser ( user services . User ) error { if ! cstrings . IsValidUnixUser ( user . GetName ( ) ) { return trace . BadParameter ( " " , user . GetName ( ) ) } for _ , l := range user . GetAllowedLogins ( ) { if ! cstrings . IsValidUnixUser ( l ) { return trace . BadParameter ( " " , l ) } } for _ , i := range user . GetIdentities ( ) { if err := i . Check ( ) ; err != nil { return trace . Wrap ( err ) } } data , err := json . Marshal ( user ) if err != nil { return trace . Wrap ( err ) } err = s . backend . UpsertVal ( [ ] string { " " , " " , user . GetName ( ) } , " " , [ ] byte ( data ) , backend . Forever ) if err != nil { return trace . Wrap ( err ) } return nil }
UpsertUser updates parameters about user
UpsertUser updates parameters about user