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])
39 @client_application = @user.client_applications.find(params[:id])
40 if @client_application.update_attributes(application_params)
41 flash[:notice] = t'oauth_clients.update.flash'
42 redirect_to :action => "show", :id => @client_application.id
44 render :action => "edit"
49 @client_application = @user.client_applications.find(params[:id])
50 @client_application.destroy
51 flash[:notice] = t'oauth_clients.destroy.flash'
52 redirect_to :action => "index"
55 def application_params
56 params.require(:client_application).permit(:name, :url, :callback_url, :support_url, ClientApplication.all_permissions)