Sha256: 54d1cc0a59f4dba6ef941dc49797642a83c880c7793f3f475a986eeafd73dc2b

Contents?: true

Size: 1.21 KB

Versions: 72

Compression:

Stored size: 1.21 KB

Contents

class OauthController < ApplicationController

  # TODO
  # Routes for this controller are not provided by the gem and
  # should be set according to your needs

  def request_omniauth
    org_uid = params[:org_uid]
    organization = Maestrano::Connector::Rails::Organization.find_by_uid(org_uid)

    if organization && is_admin?(current_user, organization)
      # TODO
      # Perform oauth request here. The oauth process should be able to
      # remember the organization, either by a param in the request or using
      # a session
    else
      redirect_to root_url
    end
  end

  def create_omniauth
    org_uid = '' # TODO
    organization = Maestrano::Connector::Rails::Organization.find_by_uid(org_uid)

    if organization && is_admin?(current_user, organization)
      # TODO
      # Update organization with oauth params
    end

    redirect_to root_url
  end

  def destroy_omniauth
    organization = Maestrano::Connector::Rails::Organization.find(params[:organization_id])

    if organization && is_admin?(current_user, organization)
      organization.oauth_uid = nil
      organization.oauth_token = nil
      organization.refresh_token = nil
      organization.save
    end

    redirect_to root_url
  end
end

Version data entries

72 entries across 56 versions & 1 rubygems

Version Path
maestrano-connector-rails-0.2.5 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.2.5 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.2.4 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.2.4 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.2.3 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.2.3 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.2.2 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.2.2 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.2.0 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.2.0 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.0.1 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.0.1 lib/generators/connector/templates/oauth_controller.rb