<commit_before>module ActionDispatch::Routing
  class Mapper
    # Includes mount_opro_oauth method for routes. This method is responsible to
    # generate all needed routes for oauth
    def mount_opro_oauth(options = {})
      skip_routes = options[:except].is_a?(Array) ? options[:except] : [options[:except]]
      controllers = options[:controllers] || {}

      match 'oauth/new'          => 'opro/oauth/auth#new',          :as => 'oauth_new'
      match 'oauth/authorize'    => 'opro/oauth/auth#create',       :as => 'oauth_authorize'
      match 'oauth/token'        => 'opro/oauth/token#create',      :as => 'oauth_token'

      resources :oauth_docs,        :controller => controllers[:oauth_docs]       ||'opro/oauth/docs', :only => [:index, :show] unless skip_routes.include?(:docs)
      resources :oauth_tests,       :controller => controllers[:oauth_tests]      ||'opro/oauth/tests', :only => [:index, :show, :create, :destroy] unless skip_routes.include?(:tests)
      resources :oauth_client_apps, :controller => controllers[:oauth_client_apps]||'opro/oauth/client_app' unless skip_routes.include?(:client_apps)
    end
  end
end
<commit_msg>Restrict the client_app routes to those defined in the controller<commit_after>module ActionDispatch::Routing
  class Mapper
    # Includes mount_opro_oauth method for routes. This method is responsible to
    # generate all needed routes for oauth
    def mount_opro_oauth(options = {})
      skip_routes = options[:except].is_a?(Array) ? options[:except] : [options[:except]]
      controllers = options[:controllers] || {}

      match 'oauth/new'          => 'opro/oauth/auth#new',          :as => 'oauth_new'
      match 'oauth/authorize'    => 'opro/oauth/auth#create',       :as => 'oauth_authorize'
      match 'oauth/token'        => 'opro/oauth/token#create',      :as => 'oauth_token'

      resources :oauth_docs,        :controller => controllers[:oauth_docs]       ||'opro/oauth/docs',       :only => [:index, :show]                    unless skip_routes.include?(:docs)
      resources :oauth_tests,       :controller => controllers[:oauth_tests]      ||'opro/oauth/tests',      :only => [:index, :show, :create, :destroy] unless skip_routes.include?(:tests)
      resources :oauth_client_apps, :controller => controllers[:oauth_client_apps]||'opro/oauth/client_app', :only => [:new, :index, :create]            unless skip_routes.include?(:client_apps)
    end
  end
end

{'fraction_non_alphanumeric': 0.14017163874131588, 'fraction_numerical': 0.0, 'mean_word_length': 3.4347826086956523, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '84854', 'n_tokens_mistral': 769, 'n_tokens_neox': 755, 'n_words': 161}