Add provider_item.go

This commit is contained in:
Yang Luo
2021-06-16 00:18:56 +08:00
parent 8bc9163def
commit 7ea469e876
4 changed files with 57 additions and 24 deletions

View File

@ -54,26 +54,15 @@ func GetApplications(owner string) []*Application {
return applications
}
func (application *Application) GetProviderItem(providerName string) *ProviderItem {
for _, providerItem := range application.Providers {
if providerItem.Name == providerName {
return providerItem
}
}
return nil
}
func getProviderMap(owner string) map[string]*Provider {
providers := GetProviders(owner)
m := map[string]*Provider{}
for _, provider := range providers {
if provider.Category != "OAuth" {
continue
}
//if provider.Category != "OAuth" {
// continue
//}
provider.ClientSecret = ""
provider.ProviderUrl = ""
m[provider.Name] = provider
m[provider.Name] = getMaskedProvider(provider)
}
return m
}