X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/16f704326f44fd1e5e5e60b936c9b5895d6a6ff8..c5f67bbc40e8f6a98854b1bf67fc6a98cff80790:/services/api/app/models/api_client.rb diff --git a/services/api/app/models/api_client.rb b/services/api/app/models/api_client.rb index 1f95d78c0c..8ed693f820 100644 --- a/services/api/app/models/api_client.rb +++ b/services/api/app/models/api_client.rb @@ -13,4 +13,25 @@ class ApiClient < ArvadosModel t.add :url_prefix t.add :is_trusted end + + def is_trusted + norm(self.url_prefix) == norm(Rails.configuration.Services.Workbench1.ExternalURL) || + norm(self.url_prefix) == norm(Rails.configuration.Services.Workbench2.ExternalURL) || + super + end + + protected + + def norm url + # normalize URL for comparison + url = URI(url) + if url.scheme == "https" + url.port == "443" + end + if url.scheme == "http" + url.port == "80" + end + url.path = "/" + url + end end