gdpr_rails 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/mailers/policy_manager/application_mailer.rb +0 -13
- data/app/mailers/policy_manager/portability_mailer.rb +35 -8
- data/app/models/policy_manager/portability_request.rb +5 -1
- data/app/views/policy_manager/portability_mailer/admin_notification.erb +3 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/lib/policy_manager/config.rb +11 -1
- data/lib/policy_manager/exporter/view.rb +1 -1
- data/lib/policy_manager/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdac527992aa3750ca683a3b17605e9f5726b4bf
|
4
|
+
data.tar.gz: b020e00e20481d8c6eea547fefe3534015ad263a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 758502951aaf60f3168c55c95938462dc9cf1433ae7fc0dc259a4a746a7d371eadc71b04b5c85605b3a8bc84accee94dfd6f614a2b982085b520a4ba387061e7
|
7
|
+
data.tar.gz: 8630dddce297c8bd2be235bac6eb52c385c968ca42f7db3961605e72d87784be9733b7bb1d66a53a336f852db6e52f9fd0ab32a86c2597c44c7b15206ef7e1ea
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ Portability module lets you define export options, that will generate a navigabl
|
|
35
35
|
#### Scripts & Cookies
|
36
36
|
Configurable *scripts* which will bind cookie names in order to handle the script rendering and the cookie clean up.
|
37
37
|
|
38
|
-
####
|
38
|
+
#### Forgetability
|
39
39
|
+ TBD, for now we simply delete all the data when a user closes the account. This could be handled in the future with encryption like in emails or other kind of sensible fields on a database.
|
40
40
|
|
41
41
|
### Admin Panel
|
@@ -61,6 +61,7 @@ Install & run the migrations
|
|
61
61
|
config = PolicyManager::Config.setup do |c|
|
62
62
|
c.logout_url = "logout"
|
63
63
|
c.from_email = "admin@acme.com"
|
64
|
+
c.admin_email_inbox = "foo@baaz.org"
|
64
65
|
# is_admin method in order for engine to know
|
65
66
|
# how to authorize admin only areas
|
66
67
|
c.is_admin_method = ->(o){
|
@@ -7,18 +7,5 @@ module PolicyManager
|
|
7
7
|
Config.exporter.mail_helpers.each do |helpers|
|
8
8
|
add_template_helper(helpers)
|
9
9
|
end
|
10
|
-
|
11
|
-
def send!(opts = {})
|
12
|
-
|
13
|
-
I18n.locale = Config.user_language(@user)
|
14
|
-
|
15
|
-
default_opts = {
|
16
|
-
:to => @user.email,
|
17
|
-
:subject => @subject
|
18
|
-
}.merge(opts)
|
19
|
-
|
20
|
-
mail(default_opts)
|
21
|
-
end
|
22
|
-
|
23
10
|
end
|
24
11
|
end
|
@@ -4,30 +4,57 @@ module PolicyManager
|
|
4
4
|
def progress_notification(portability_request_id)
|
5
5
|
@portability_request = PortabilityRequest.find(portability_request_id)
|
6
6
|
@user = User.find(@portability_request.user_id)
|
7
|
-
@subject = I18n.t("terms_app.mails.progress.subject")
|
8
7
|
|
9
|
-
opts = {}
|
8
|
+
opts = { :to => @user.email, :subject => I18n.t("terms_app.mails.progress.subject") }
|
10
9
|
opts.merge!({
|
11
10
|
template_path: PolicyManager::Config.exporter.mailer_templates[:path].to_s,
|
12
11
|
template_name: PolicyManager::Config.exporter.mailer_templates[:progress]
|
13
|
-
}) if
|
12
|
+
}) if has_custom_template?(:progress)
|
14
13
|
|
15
|
-
|
14
|
+
set_mail_lang
|
15
|
+
|
16
|
+
mail(opts)
|
16
17
|
end
|
17
18
|
|
18
19
|
def completed_notification(portability_request_id)
|
19
20
|
@portability_request = PortabilityRequest.find(portability_request_id)
|
20
21
|
@user = User.find(@portability_request.user_id)
|
21
|
-
@subject = I18n.t("terms_app.mails.completed.subject")
|
22
22
|
@link = @portability_request.download_link
|
23
23
|
|
24
|
-
opts = {}
|
24
|
+
opts = { :to => @user.email, :subject => I18n.t("terms_app.mails.completed.subject") }
|
25
25
|
opts.merge!({
|
26
26
|
template_path: PolicyManager::Config.exporter.mailer_templates[:path].to_s,
|
27
27
|
template_name: PolicyManager::Config.exporter.mailer_templates[:complete]
|
28
|
-
}) if
|
28
|
+
}) if has_custom_template?(:complete)
|
29
29
|
|
30
|
-
|
30
|
+
set_mail_lang
|
31
|
+
|
32
|
+
mail(opts)
|
33
|
+
end
|
34
|
+
|
35
|
+
def admin_notification(user_id)
|
36
|
+
@user = User.find(user_id)
|
37
|
+
|
38
|
+
opts = { :to => Config.admin_email(@user), :subject => I18n.t("terms_app.mails.admin.subject", email: @user.email) }
|
39
|
+
opts.merge!({
|
40
|
+
template_path: PolicyManager::Config.exporter.mailer_templates[:path].to_s,
|
41
|
+
template_name: PolicyManager::Config.exporter.mailer_templates[:admin]
|
42
|
+
}) if has_custom_template?(:admin)
|
43
|
+
|
44
|
+
set_mail_lang
|
45
|
+
|
46
|
+
mail(opts)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def set_mail_lang
|
52
|
+
I18n.locale = Config.user_language(@user)
|
53
|
+
end
|
54
|
+
|
55
|
+
def has_custom_template?(template)
|
56
|
+
return false if PolicyManager::Config.exporter.mailer_templates.blank?
|
57
|
+
PolicyManager::Config.exporter.mailer_templates[template].present? && PolicyManager::Config.exporter.mailer_templates[:path].to_s.present?
|
31
58
|
end
|
32
59
|
|
33
60
|
end
|
@@ -17,7 +17,7 @@ module PolicyManager
|
|
17
17
|
include AASM
|
18
18
|
|
19
19
|
aasm column: :state do
|
20
|
-
state :pending, :initial => true
|
20
|
+
state :pending, :initial => true, :after_enter => :notify_progress_to_admin
|
21
21
|
state :progress, :after_enter => :handle_progress
|
22
22
|
state :completed, :after_enter => :notify_completeness
|
23
23
|
|
@@ -57,6 +57,10 @@ module PolicyManager
|
|
57
57
|
PortabilityMailer.progress_notification(self.id).deliver_now
|
58
58
|
end
|
59
59
|
|
60
|
+
def notify_progress_to_admin
|
61
|
+
PortabilityMailer.admin_notification(self.user.id).deliver_now
|
62
|
+
end
|
63
|
+
|
60
64
|
def notify_completeness
|
61
65
|
PortabilityMailer.completed_notification(self.id).deliver_now
|
62
66
|
end
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -6,7 +6,9 @@ module PolicyManager
|
|
6
6
|
:is_admin_method,
|
7
7
|
:logout_url,
|
8
8
|
:user_language_method,
|
9
|
-
:scripts
|
9
|
+
:scripts,
|
10
|
+
:admin_email_inbox,
|
11
|
+
:error_notifier
|
10
12
|
|
11
13
|
def self.setup
|
12
14
|
@@rules = []
|
@@ -16,6 +18,14 @@ module PolicyManager
|
|
16
18
|
yield self
|
17
19
|
self
|
18
20
|
end
|
21
|
+
|
22
|
+
def self.error_notifier_method(error)
|
23
|
+
@@error_notifier.call(error)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.admin_email(user)
|
27
|
+
@@admin_email_inbox.is_a?(Proc) ? @@admin_email_inbox.call(user) : @@admin_email_inbox
|
28
|
+
end
|
19
29
|
|
20
30
|
def self.exporter=(opts)
|
21
31
|
@@exporter = Exporter.new(opts)
|
@@ -56,7 +56,7 @@ module PolicyManager
|
|
56
56
|
self.save_image(remote_image, path)
|
57
57
|
tag(:img, {src: "./#{id}-#{File.basename(URI(remote_image).path)}" }.merge(opts))
|
58
58
|
rescue => e
|
59
|
-
|
59
|
+
Config.error_notifier_method(e)
|
60
60
|
content_tag(:p, "broken image")
|
61
61
|
end
|
62
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gdpr_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Michelson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-05-
|
12
|
+
date: 2018-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- app/views/layouts/policy_manager/mailer.text.erb
|
225
225
|
- app/views/policy_manager/categories/index.html.erb
|
226
226
|
- app/views/policy_manager/categories/show.html.erb
|
227
|
+
- app/views/policy_manager/portability_mailer/admin_notification.erb
|
227
228
|
- app/views/policy_manager/portability_mailer/completed_notification.erb
|
228
229
|
- app/views/policy_manager/portability_mailer/progress_notification.erb
|
229
230
|
- app/views/policy_manager/portability_requests/index.html.erb
|