Module: MnoEnterprise::Concerns::Controllers::Webhook::OAuthController
- Extended by:
- ActiveSupport::Concern
- Includes:
- ImageHelper
- Included in:
- Webhook::OAuthController
- Defined in:
- lib/mno_enterprise/concerns/controllers/webhook/o_auth_controller.rb
Instance Method Summary collapse
-
#authorize ⇒ Object
Instance methods ================================================================== GET /mnoe/webhook/oauth/:id/authorize.
-
#callback ⇒ Object
GET /mnoe/webhook/oauth/:id/callback.
-
#disconnect ⇒ Object
GET /mnoe/webhook/oauth/:id/disconnect.
-
#sync ⇒ Object
GET /mnoe/webhook/oauth/:id/sync.
Instance Method Details
#authorize ⇒ Object
Instance methods
GET /mnoe/webhook/oauth/:id/authorize
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/mno_enterprise/concerns/controllers/webhook/o_auth_controller.rb', line 58 def if params[:redirect_path].present? session[:redirect_path] = params[:redirect_path] end # Certain providers require options to be selected if !params[:perform] && app_instance.app && PROVIDERS_WITH_OPTIONS.include?(app_instance.app.nid.to_s) render "mno_enterprise/webhook/o_auth/providers/#{app_instance.app.nid}" return end @redirect_to = MnoEnterprise.router.(params[:id], extra_params.merge(wtk: wtk)) end |
#callback ⇒ Object
GET /mnoe/webhook/oauth/:id/callback
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/mno_enterprise/concerns/controllers/webhook/o_auth_controller.rb', line 73 def callback path = session.delete(:redirect_path).presence || mnoe_home_path if error_key = params.fetch(:oauth, {})[:error] path = add_param_to_fragment(path.to_s, 'flash', [{msg: (error_key), type: :error}.to_json]) end unless params.fetch(:oauth, {})[:error] case params.fetch(:oauth, {})[:action] when 'sync' MnoEnterprise::EventLogger.info('app_connected', current_user.id, 'App connected', app_instance) when 'disconnect' MnoEnterprise::EventLogger.info('app_disconnected', current_user.id, 'App disconnected', app_instance) end end redirect_to path end |
#disconnect ⇒ Object
GET /mnoe/webhook/oauth/:id/disconnect
93 94 95 |
# File 'lib/mno_enterprise/concerns/controllers/webhook/o_auth_controller.rb', line 93 def disconnect redirect_to MnoEnterprise.router.disconnect_oauth_url(params[:id], extra_params.merge(wtk: wtk)) end |
#sync ⇒ Object
GET /mnoe/webhook/oauth/:id/sync
98 99 100 |
# File 'lib/mno_enterprise/concerns/controllers/webhook/o_auth_controller.rb', line 98 def sync redirect_to MnoEnterprise.router.sync_oauth_url(params[:id], extra_params.merge(wtk: wtk)) end |