diff --git a/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb b/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb index c5ba074407e0..ab54f477fff7 100644 --- a/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb +++ b/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb @@ -10,7 +10,9 @@ class ProvidersController < ::ApplicationController before_action :find_provider, only: %i[edit update destroy] before_action :set_edit_state, only: %i[create edit update] - def index; end + def index + @providers = ::OpenIDConnect::Provider.all + end def new oidc_provider = case params[:oidc_provider] @@ -81,16 +83,10 @@ def check_ee end def find_provider - @provider = providers.where(id: params[:id]).first - if @provider.nil? - render_404 - end - end - - def providers - @providers ||= ::OpenIDConnect::Provider.where(available: true) + @provider = OpenIDConnect::Provider.find(params[:id]) + rescue ActiveRecord::RecordNotFound + render_404 end - helper_method :providers def default_breadcrumb; end diff --git a/modules/openid_connect/app/views/openid_connect/providers/index.html.erb b/modules/openid_connect/app/views/openid_connect/providers/index.html.erb index 30c030c5613e..69ee277667dc 100644 --- a/modules/openid_connect/app/views/openid_connect/providers/index.html.erb +++ b/modules/openid_connect/app/views/openid_connect/providers/index.html.erb @@ -35,4 +35,4 @@ end %> -<%= render ::OpenIDConnect::Providers::TableComponent.new(rows: providers) %> +<%= render ::OpenIDConnect::Providers::TableComponent.new(rows: @providers) %>