Class: Toolchest::Oauth::AuthorizedApplicationsController

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

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /mcp/oauth/authorized_applications/:id



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/toolchest/oauth/authorized_applications_controller.rb', line 10

def destroy
  app = Toolchest::OauthApplication.find_by(id: params[:id])

  unless app
    redirect_to "#{request.script_name}/oauth/authorized_applications",
      alert: "Application not found."
    return
  end

  Toolchest::OauthAccessToken.revoke_all_for(app, current_resource_owner_id)
  Toolchest::OauthAccessGrant.revoke_all_for(app, current_resource_owner_id)

  redirect_to "#{request.script_name}/oauth/authorized_applications",
    notice: "#{app.name} has been disconnected."
end

#indexObject

GET /mcp/oauth/authorized_applications



7
# File 'app/controllers/toolchest/oauth/authorized_applications_controller.rb', line 7

def index = @applications = authorized_applications