func getConnectorForUserByEmail(ur user.UserRepo, email string) (string, error) { usr, err := ur.GetByEmail(nil, email) if err != nil { return "", err } rids, err := ur.GetRemoteIdentities(nil, usr.ID) if err != nil { return "", err } if len(rids) == 0 { return "", fmt.Errorf("No remote Identities for user %v", usr.ID) } return rids[0].ConnectorID, nil }