Sha256: 34cd4d667f8f5c6171fe788cd531eb1ebd92980f0b435a56dae99a41cca5db4b

Contents?: true

Size: 1.46 KB

Versions: 32

Compression:

Stored size: 1.46 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

32 entries across 32 versions & 5 rubygems

Version Path
filiptepper-oauth-plugin-0.3.11 generators/oauth_provider/templates/clients_controller.rb
pelle-oauth-plugin-0.3.10 generators/oauth_provider/templates/clients_controller.rb
pelle-oauth-plugin-0.3.11 generators/oauth_provider/templates/clients_controller.rb
pelle-oauth-plugin-0.3.5 generators/oauth_provider/templates/clients_controller.rb
pelle-oauth-plugin-0.3.6 generators/oauth_provider/templates/clients_controller.rb
pelle-oauth-plugin-0.3.7 generators/oauth_provider/templates/clients_controller.rb
pelle-oauth-plugin-0.3.8 generators/oauth_provider/templates/clients_controller.rb
pelle-oauth-plugin-0.3.9 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.rc2 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.rc1 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.pre7 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.pre6 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.pre5 generators/oauth_provider/templates/clients_controller.rb
insrc-oauth-plugin-0.4.0.pre6 generators/oauth_provider/templates/clients_controller.rb
insrc-oauth-plugin-0.4.0.pre5 generators/oauth_provider/templates/clients_controller.rb
le1t0-oauth-plugin-0.3.14.001 generators/oauth_provider/templates/clients_controller.rb
le1t0-oauth-plugin-0.4.0.pre4.001 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.pre4 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.pre3 generators/oauth_provider/templates/clients_controller.rb
oauth-plugin-0.4.0.pre2 generators/oauth_provider/templates/clients_controller.rb