Class: Oauth::ProvidersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/oauth/providers_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#after_sign_in_path_for, #api_authenticate!, #current_project, #expire_revision!, #followed_projects, #no_cache, #read_revision, #require_login, #return_or_cache_revision!, #revision, #unfurling?, #with_current_project

Methods included from UrlHelper

#feature_path, #link_to_project_feature

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/oauth/providers_controller.rb', line 16

def create
  @provider = Oauth::Provider.new(params[:oauth_provider])
  authorize! :create, @provider

  if @provider.save
    redirect_to oauth_providers_path
  else
    render action: :new
  end
end

#editObject



27
28
29
30
31
# File 'app/controllers/oauth/providers_controller.rb', line 27

def edit
  @title = "Edit Provider"
  @provider = Oauth::Provider.find(params[:id])
  authorize! :update, @provider
end

#indexObject



4
5
6
7
8
# File 'app/controllers/oauth/providers_controller.rb', line 4

def index
  @title = "Providers"
  authorize! :read, Oauth::Provider
  @providers = Oauth::Provider.all
end

#newObject



10
11
12
13
14
# File 'app/controllers/oauth/providers_controller.rb', line 10

def new
  @title = "New Provider"
  authorize! :create, Oauth::Provider
  @provider = Oauth::Provider.new
end

#updateObject



33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/oauth/providers_controller.rb', line 33

def update
  @provider = Oauth::Provider.find(params[:id])
  authorize! :update, @provider

  if @provider.update_attributes(params[:oauth_provider])
    redirect_to oauth_providers_path
  else
    render action: :edit
  end
end