1 class OauthClientsController < ApplicationController
4 before_action :authorize_web
5 before_action :set_locale
7 authorize_resource :class => ClientApplication
10 @client_applications = current_user.client_applications
11 @tokens = current_user.oauth_tokens.authorized
15 @client_application = current_user.client_applications.find(params[:id])
16 rescue ActiveRecord::RecordNotFound
17 @type = "client application"
18 render :action => "not_found", :status => :not_found
22 @client_application = ClientApplication.new
26 @client_application = current_user.client_applications.find(params[:id])
27 rescue ActiveRecord::RecordNotFound
28 @type = "client application"
29 render :action => "not_found", :status => :not_found
33 @client_application = current_user.client_applications.build(application_params)
34 if @client_application.save
35 flash[:notice] = t ".flash"
36 redirect_to :action => "show", :id => @client_application.id
38 render :action => "new"
43 @client_application = current_user.client_applications.find(params[:id])
44 if @client_application.update(application_params)
45 flash[:notice] = t ".flash"
46 redirect_to :action => "show", :id => @client_application.id
48 render :action => "edit"
50 rescue ActiveRecord::RecordNotFound
51 @type = "client application"
52 render :action => "not_found", :status => :not_found
56 @client_application = current_user.client_applications.find(params[:id])
57 @client_application.destroy
58 flash[:notice] = t ".flash"
59 redirect_to :action => "index"
60 rescue ActiveRecord::RecordNotFound
61 @type = "client application"
62 render :action => "not_found", :status => :not_found
67 def application_params
68 params.require(:client_application).permit(:name, :url, :callback_url, :support_url, ClientApplication.all_permissions)