From cc0e23280896ec0f643596fc917a5baa67d2c454 Mon Sep 17 00:00:00 2001 From: Akos Birmacher Date: Thu, 3 May 2018 16:14:57 +0200 Subject: [PATCH] The team will not be listed if it has no certificate to export. --- cmd/common.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cmd/common.go b/cmd/common.go index 3c62b4e0..80963ce3 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -325,7 +325,9 @@ Would you like to use this team to sign your project?`, archiveCertificate.TeamI if !useArchiveTeam { teams := []string{} for team := range certificatesByTeam { - teams = append(teams, team) + if teamHasCertificates(archiveCertificate, certificatesByTeam[team]) { + teams = append(teams, team) + } } fmt.Println() @@ -867,6 +869,20 @@ func UploadIdentity(bitriseClient *bitriseclient.BitriseClient, outputDirPath st return bitriseClient.ConfirmIdentityUpload(certificateResponseData.Slug, certificateResponseData.UploadFileName) } +func teamHasCertificates(archiveCertificate certificateutil.CertificateInfoModel, certificates []certificateutil.CertificateInfoModel) bool { + if isDistributionCertificate(archiveCertificate) { + developmentCertificates := certificateutil.FilterCertificateInfoModelsByFilterFunc(certificates, func(certInfo certificateutil.CertificateInfoModel) bool { + return !isDistributionCertificate(certInfo) + }) + return len(developmentCertificates) > 0 + } + + distributionCertificates := certificateutil.FilterCertificateInfoModelsByFilterFunc(certificates, func(certInfo certificateutil.CertificateInfoModel) bool { + return isDistributionCertificate(certInfo) + }) + return len(distributionCertificates) > 0 +} + func askAccessToken() (token string, err error) { messageToAsk := `Please copy your personal access token to Bitrise. (To acquire a Personal Access Token for your user, sign in with that user on bitrise.io, go to your Account Settings page,