1 class OauthClientsController < ApplicationController
4 before_filter :authorize_web
5 before_filter :set_locale
6 before_filter :require_user
9 @client_applications = @user.client_applications
10 @tokens = @user.oauth_tokens.authorized
14 @client_application = ClientApplication.new
18 @client_application = @user.client_applications.build(application_params)
19 if @client_application.save
20 flash[:notice] = t 'oauth_clients.create.flash'
21 redirect_to :action => "show", :id => @client_application.id
23 render :action => "new"
28 @client_application = @user.client_applications.find(params[:id])
29 rescue ActiveRecord::RecordNotFound
30 @type = "client application"
31 render :action => "not_found", :status => :not_found
35 @client_application = @user.client_applications.find(params[:id])
36 rescue ActiveRecord::RecordNotFound
37 @type = "client application"
38 render :action => "not_found", :status => :not_found
42 @client_application = @user.client_applications.find(params[:id])
43 if @client_application.update_attributes(application_params)
44 flash[:notice] = t 'oauth_clients.update.flash'
45 redirect_to :action => "show", :id => @client_application.id
47 render :action => "edit"
49 rescue ActiveRecord::RecordNotFound
50 @type = "client application"
51 render :action => "not_found", :status => :not_found
55 @client_application = @user.client_applications.find(params[:id])
56 @client_application.destroy
57 flash[:notice] = t 'oauth_clients.destroy.flash'
58 redirect_to :action => "index"
59 rescue ActiveRecord::RecordNotFound
60 @type = "client application"
61 render :action => "not_found", :status => :not_found
66 def application_params
67 params.require(:client_application).permit(:name, :url, :callback_url, :support_url, ClientApplication.all_permissions)