Sha256: e61bceb8b383a269893b3034c13a3128d604e3f025ffcde81570f78d3e428688

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 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
    if is_admin
      # 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_and_tenant(org_uid, current_user.tenant)

    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_by_id(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

11 entries across 11 versions & 1 rubygems

Version Path
maestrano-connector-rails-0.3.6 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.3.5 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.3.4 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.3.3 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.3.2 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.3.1 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.3.0 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.2.20 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.2.19 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.2.18 lib/generators/connector/templates/oauth_controller.rb
maestrano-connector-rails-0.2.17 lib/generators/connector/templates/oauth_controller.rb