isaca-rails 0.4.6 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/isaca/rails/users_consent_controller.rb +11 -2
- data/app/models/user_consent/agreement/form_object.rb +2 -16
- data/app/views/isaca/rails/users_consent/_form.html.erb +1 -1
- data/config/locales/isaca-rails.en.yml +1 -0
- data/lib/isaca/rails/authentication.rb +2 -8
- data/lib/isaca/rails/authorization.rb +1 -1
- data/lib/isaca/rails/user.rb +1 -1
- data/lib/isaca/rails/version.rb +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90c702697899fa3268bb9f7e7b9520b40fd5d3b7effd2ed3de3b8626cb44bb4d
|
4
|
+
data.tar.gz: 799f89cdc87027c6330c3cb2a07545e6ea18068bcd7be37661c70afb1774e4bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a5961e510658f1922bbbe6dba3a0c58a6c83b8f045a6b605b66c36e5f4f17003087861ac58a7928dd892f6379acc930fb7733c8d8c42a57f359aacbe68c7522
|
7
|
+
data.tar.gz: 1c4efa1deb6a46bec6c88ff47bab3aceca1a19915f5fc33ac4eef6fd194cc1d5df720250a6e4a73480a0abd61cd760faf9749d0731a2da98232cb32a73446044
|
@@ -8,8 +8,17 @@ class Isaca::Rails::UsersConsentController < Isaca::Rails::ApplicationController
|
|
8
8
|
def create
|
9
9
|
@form_object = UserConsent::Agreement::FormObject.new(agreement_params)
|
10
10
|
|
11
|
-
if @form_object.
|
12
|
-
|
11
|
+
if @form_object.valid?
|
12
|
+
response = Isaca::Request::ReportConsent.get(current_isaca_user.imis_id, current_isaca_user.email, {
|
13
|
+
marketing: agreement_params[:marketing_policy]
|
14
|
+
})
|
15
|
+
|
16
|
+
if response
|
17
|
+
flash.notice = t('isaca.rails.user_consent.consent_submitted')
|
18
|
+
else
|
19
|
+
flash.alert = t('isaca.rails.user_consent.consent_failed')
|
20
|
+
end
|
21
|
+
|
13
22
|
redirect_after_sign_in_or(root_path)
|
14
23
|
else
|
15
24
|
render :show
|
@@ -1,25 +1,11 @@
|
|
1
1
|
module UserConsent
|
2
2
|
module Agreement
|
3
|
-
# Form object used for handling user consent
|
4
3
|
class FormObject
|
5
4
|
include ActiveModel::Model
|
6
5
|
|
7
6
|
attr_accessor :privacy_policy, :marketing_policy
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
# Method used to report user consent of the privacy policy and marketing
|
13
|
-
#
|
14
|
-
# @param options [Hash] Optional. If not provided, marketing consent will default to NO [0].
|
15
|
-
#
|
16
|
-
# == Options
|
17
|
-
# [marketing] Consent for marketing. Acceptable values are 0 [for NO] and 1 [for YES].
|
18
|
-
#
|
19
|
-
# @return [Boolean] Whether or not the consent was successfully reported to ISACA
|
20
|
-
def report_consent(imis_id, options={})
|
21
|
-
Isaca::Request::ReportConsent.get(imis_id, options).success? if valid?
|
22
|
-
end
|
7
|
+
validates :privacy_policy, acceptance: {accept: %w(0 1)}, allow_nil: false
|
8
|
+
validates :marketing_policy, acceptance: {accept: %w(0 1)}, allow_nil: false
|
23
9
|
|
24
10
|
# Defining this method allows us to use some ActiveModel patterns. For example, forms will be identified
|
25
11
|
# as sign_in instead of session_sign_in_form_object.
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= f.check_box :privacy_policy %>
|
7
7
|
|
8
8
|
ISACA has changed their privacy notice, to access the revised notice and terms,
|
9
|
-
<a href="https://www.isaca.org/pages/Privacy.aspx" target="_blank">click here</a>.
|
9
|
+
<a href="https://www.isaca.org/pages/Privacy.aspx" target="_blank">click here</a> and this Platform's Terms of Use <a href="/terms_of_use" target="_blank">click here</a>.
|
10
10
|
|
11
11
|
By continuing to use the site you agree to the revised terms.
|
12
12
|
</label>
|
@@ -14,6 +14,7 @@ en:
|
|
14
14
|
user_consent:
|
15
15
|
consent_required: Your consent is required before proceeding.
|
16
16
|
consent_submitted: You have successfully updated your privacy policy and marketing preferences.
|
17
|
+
consent_failed: An error occurred that prevented you from submitting your consent form.
|
17
18
|
administrators:
|
18
19
|
email_not_found: Could not find a record with the provided email.
|
19
20
|
created: Administrator was successfully created.
|
@@ -160,14 +160,8 @@ module Isaca
|
|
160
160
|
klass = Isaca::Rails.configuration.user_model
|
161
161
|
|
162
162
|
# Fetch the first record with a matching imis id or initialize a new record with the given user data.
|
163
|
-
@current_isaca_user = klass.
|
164
|
-
|
165
|
-
# Update the old user record or save a new user record
|
166
|
-
if @current_isaca_user.new_record?
|
167
|
-
@current_isaca_user.save
|
168
|
-
else
|
169
|
-
@current_isaca_user.update_attributes(attributes)
|
170
|
-
end
|
163
|
+
@current_isaca_user = klass.where(imis_id: isaca_user.imis_id).first_or_initialize
|
164
|
+
@current_isaca_user.update_attributes(attributes)
|
171
165
|
|
172
166
|
# Temporal data so we do not need dedicated columns for this but we do need to associate it with the user
|
173
167
|
@current_isaca_user.privacy = isaca_user.privacy
|
data/lib/isaca/rails/user.rb
CHANGED
data/lib/isaca/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isaca-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Orahood
|
8
|
-
|
8
|
+
- Shaun Eutsey
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-09-08 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
@@ -30,14 +31,14 @@ dependencies:
|
|
30
31
|
requirements:
|
31
32
|
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
34
|
+
version: '1.4'
|
34
35
|
type: :runtime
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
41
|
+
version: '1.4'
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
43
|
name: sass-rails
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -223,6 +224,7 @@ dependencies:
|
|
223
224
|
description: Description of Isaca::Rails.
|
224
225
|
email:
|
225
226
|
- morahood@gmail.com
|
227
|
+
- seutsey@isaca.org
|
226
228
|
executables: []
|
227
229
|
extensions: []
|
228
230
|
extra_rdoc_files: []
|
@@ -285,10 +287,10 @@ files:
|
|
285
287
|
- lib/isaca/rails/user.rb
|
286
288
|
- lib/isaca/rails/version.rb
|
287
289
|
- lib/tasks/isaca/rails_tasks.rake
|
288
|
-
homepage:
|
290
|
+
homepage:
|
289
291
|
licenses: []
|
290
292
|
metadata: {}
|
291
|
-
post_install_message:
|
293
|
+
post_install_message:
|
292
294
|
rdoc_options: []
|
293
295
|
require_paths:
|
294
296
|
- lib
|
@@ -303,9 +305,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
303
305
|
- !ruby/object:Gem::Version
|
304
306
|
version: '0'
|
305
307
|
requirements: []
|
306
|
-
|
307
|
-
|
308
|
-
signing_key:
|
308
|
+
rubygems_version: 3.2.27
|
309
|
+
signing_key:
|
309
310
|
specification_version: 4
|
310
311
|
summary: Summary of Isaca::Rails.
|
311
312
|
test_files: []
|