Class: Oauth2Provider::ScopesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/oauth2_provider/scopes_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#_oauth_provider_admin?

Methods included from ControllerMixin

#_oauth_provider_authenticate, #_oauth_provider_json_body, #_oauth_provider_normalize_token, #api_request, #json?, #oauth_authorized, #session_auth

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/oauth2_provider/scopes_controller.rb', line 18

def create
  @scope        = Oauth2Provider::Scope.new(params[:scope])
  @scope.uri    = @scope.base_uri(request)
  @scope.values = @scope.normalize(params[:scope][:values])

  if @scope.save
    redirect_to(oauth2_provider_engine.oauth2_provider_scope_path(@scope), notice: "Resource was successfully created.")
  else
    render action: "new"
  end
end

#destroyObject



43
44
45
46
# File 'app/controllers/oauth2_provider/scopes_controller.rb', line 43

def destroy
  @scope.destroy
  redirect_to(scopes_url, notice: "Resource was successfully destroyed.")
end

#editObject



30
31
# File 'app/controllers/oauth2_provider/scopes_controller.rb', line 30

def edit
end

#indexObject



7
8
9
# File 'app/controllers/oauth2_provider/scopes_controller.rb', line 7

def index
  @scopes = Oauth2Provider::Scope.all
end

#newObject



14
15
16
# File 'app/controllers/oauth2_provider/scopes_controller.rb', line 14

def new
  @scope = Oauth2Provider::Scope.new
end

#showObject



11
12
# File 'app/controllers/oauth2_provider/scopes_controller.rb', line 11

def show
end

#updateObject



33
34
35
36
37
38
39
40
41
# File 'app/controllers/oauth2_provider/scopes_controller.rb', line 33

def update
  @scope.values = @scope.normalize(params[:scope][:values])

  if @scope.update_attributes(params[:scope])
    render("show", notice: "Resource was successfully updated.")
  else
    render action: "edit"
  end
end