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.4.1 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.4.0 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.13 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.12 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.11 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.10 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.9 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.8 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.7 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.6 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.5 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.4 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.3 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.2 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.1 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.3.0 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.2.20 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.2.19 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.2.18 spec/dummy/app/controllers/oauth_controller.rb
maestrano-connector-rails-0.2.17 spec/dummy/app/controllers/oauth_controller.rb