Class: Isaca::Rails::UsersConsentController

Inherits:
ApplicationController show all
Defined in:
app/controllers/isaca/rails/users_consent_controller.rb

Instance Method Summary collapse

Methods included from Authorization

#authorize_isaca_user, #claim_symbols, #user_has_privilege?

Methods included from Authentication

#authenticate, #authenticate_isaca_user, #current_isaca_user, #isaca_requires_consent?, #isaca_sign_out, #redirect_after_sign_in_or, #redirect_for_consent?, #user_signed_in?

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/isaca/rails/users_consent_controller.rb', line 8

def create
  @form_object = UserConsent::Agreement::FormObject.new(agreement_params)

  if @form_object.valid?
    response = Isaca::Request::ReportConsent.get(current_isaca_user.imis_id, current_isaca_user.email, {
        marketing: agreement_params[:marketing_policy]
    })

    if response
      flash.notice = t('isaca.rails.user_consent.consent_submitted')
    else
      flash.alert = t('isaca.rails.user_consent.consent_failed')
    end

    (root_path)
  else
    render :show
  end
end

#showObject



4
5
6
# File 'app/controllers/isaca/rails/users_consent_controller.rb', line 4

def show
  @form_object = UserConsent::Agreement::FormObject.new
end