]> git.openstreetmap.org Git - rails.git/blob - app/controllers/oauth2_applications_controller.rb
Add frozen_string_literal comments to ruby files
[rails.git] / app / controllers / oauth2_applications_controller.rb
1 # frozen_string_literal: true
2
3 class Oauth2ApplicationsController < Doorkeeper::ApplicationsController
4   layout :site_layout
5
6   prepend_before_action :authorize_web
7   before_action :set_locale
8   before_action :set_application, :only => [:show, :edit, :update, :destroy]
9
10   authorize_resource :class => false
11
12   def index
13     @applications = current_resource_owner.oauth2_applications.ordered_by(:created_at)
14   end
15
16   private
17
18   def set_application
19     @application = current_resource_owner&.oauth2_applications&.find(params[:id])
20   rescue ActiveRecord::RecordNotFound
21     render :action => "not_found", :status => :not_found
22   end
23
24   def application_params
25     params[:oauth2_application][:scopes]&.delete("")
26     params
27       .expect(:oauth2_application => [:name, :redirect_uri, :confidential, { :scopes => [] }])
28       .merge(:owner => current_resource_owner)
29   end
30 end