Sha256: ca1b95a84701acf5679a6403df7cb2453c442af51d94c6c49af5cdb8acac02ad

Contents?: true

Size: 1.45 KB

Versions: 26

Compression:

Stored size: 1.45 KB

Contents

class OauthClientsController < ApplicationController
  before_filter :login_required
  before_filter :get_client_application, :only => [:show, :edit, :update, :destroy]

  def index
    @client_applications = current_user.client_applications
    @tokens = current_user.tokens.find :all, :conditions => 'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null'
  end

  def new
    @client_application = ClientApplication.new
  end

  def create
    @client_application = current_user.client_applications.build(params[:client_application])
    if @client_application.save
      flash[:notice] = "Registered the information successfully"
      redirect_to :action => "show", :id => @client_application.id
    else
      render :action => "new"
    end
  end

  def show
  end

  def edit
  end

  def update
    if @client_application.update_attributes(params[:client_application])
      flash[:notice] = "Updated the client information successfully"
      redirect_to :action => "show", :id => @client_application.id
    else
      render :action => "edit"
    end
  end

  def destroy
    @client_application.destroy
    flash[:notice] = "Destroyed the client application registration"
    redirect_to :action => "index"
  end

  private
  def get_client_application
    unless @client_application = current_user.client_applications.find(params[:id])
      flash.now[:error] = "Wrong application id"
      raise ActiveRecord::RecordNotFound
    end
  end
end

Version data entries

26 entries across 19 versions & 6 rubygems

Version Path
houston-oauth-plugin-0.5.1 lib/generators/oauth_provider/templates/clients_controller.rb
houston-oauth-plugin-0.5.1 generators/oauth_provider/templates/clients_controller.rb
panjiva-oauth-plugin-0.4.1 lib/generators/oauth_provider/templates/clients_controller.rb
panjiva-oauth-plugin-0.4.1 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.5.1 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.5.1 lib/generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.5.0 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.5.0 lib/generators/oauth_provider/templates/clients_controller.rb
oauth-provider-0.5.0rc1 generators/oauth_provider/templates/clients_controller.rb
oauth-provider-0.5.0rc1 lib/generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.1 lib/generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.1 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0 lib/generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.rc2 lib/generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.rc1 lib/generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.pre7 lib/generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.pre6 lib/generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.pre5 lib/generators/oauth_provider/templates/clients_controller.rb
insrc-oauth-plugin-0.4.0.pre6 lib/generators/oauth_provider/templates/clients_controller.rb