egov_utils 0.1.0

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.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +26 -0
  5. data/app/assets/config/egov_utils_manifest.js +2 -0
  6. data/app/assets/javascripts/egov_utils/application.js +23 -0
  7. data/app/assets/javascripts/egov_utils/eGovUtilities.coffee.erb +70 -0
  8. data/app/assets/javascripts/egov_utils/groups.js +2 -0
  9. data/app/assets/javascripts/egov_utils/roles.coffee.erb +56 -0
  10. data/app/assets/javascripts/egov_utils/setup_locale.coffee.erb +2 -0
  11. data/app/assets/javascripts/egov_utils/users.js +2 -0
  12. data/app/assets/stylesheets/egov_utils/application.scss +15 -0
  13. data/app/assets/stylesheets/egov_utils/groups.css +4 -0
  14. data/app/assets/stylesheets/egov_utils/roles.css +4 -0
  15. data/app/assets/stylesheets/egov_utils/users.css +4 -0
  16. data/app/attributes/egov_utils/district.rb +13 -0
  17. data/app/attributes/egov_utils/full_address.rb +17 -0
  18. data/app/attributes/egov_utils/region.rb +13 -0
  19. data/app/controllers/egov_utils/addresses_controller.rb +34 -0
  20. data/app/controllers/egov_utils/application_controller.rb +7 -0
  21. data/app/controllers/egov_utils/groups_controller.rb +27 -0
  22. data/app/controllers/egov_utils/roles_controller.rb +28 -0
  23. data/app/controllers/egov_utils/sessions_controller.rb +83 -0
  24. data/app/controllers/egov_utils/users_controller.rb +64 -0
  25. data/app/helpers/egov_utils/application_helper.rb +4 -0
  26. data/app/helpers/egov_utils/grid_helper.rb +40 -0
  27. data/app/helpers/egov_utils/groups_helper.rb +4 -0
  28. data/app/helpers/egov_utils/roles_helper.rb +4 -0
  29. data/app/helpers/egov_utils/users_helper.rb +4 -0
  30. data/app/jobs/egov_utils/application_job.rb +4 -0
  31. data/app/mailers/egov_utils/application_mailer.rb +6 -0
  32. data/app/models/ability.rb +17 -0
  33. data/app/models/egov_utils/address.rb +79 -0
  34. data/app/models/egov_utils/application_record.rb +5 -0
  35. data/app/models/egov_utils/audit_detail.rb_bac +28 -0
  36. data/app/models/egov_utils/audit_record.rb_bac +98 -0
  37. data/app/models/egov_utils/group.rb +26 -0
  38. data/app/models/egov_utils/person.rb +9 -0
  39. data/app/models/egov_utils/principal.rb +20 -0
  40. data/app/models/egov_utils/user.rb +108 -0
  41. data/app/schemas/egov_utils/address_schema.rb +30 -0
  42. data/app/validators/email_validator.rb +8 -0
  43. data/app/validators/ico_validator.rb +7 -0
  44. data/app/views/common/_grid.html.coffee +130 -0
  45. data/app/views/common/_modal.html.haml +11 -0
  46. data/app/views/egov_utils/addresses/_form.html.haml +51 -0
  47. data/app/views/egov_utils/people/_form.html.haml +3 -0
  48. data/app/views/egov_utils/roles/index.html.haml +29 -0
  49. data/app/views/egov_utils/sessions/new.html.haml +5 -0
  50. data/app/views/egov_utils/users/_form.html.haml +6 -0
  51. data/app/views/egov_utils/users/index.html.haml +62 -0
  52. data/app/views/egov_utils/users/new.html.haml +3 -0
  53. data/app/views/egov_utils/users/show.html.haml +1 -0
  54. data/app/views/errors/error_403.html.haml +1 -0
  55. data/app/views/layouts/egov_utils/_messages.html.haml +7 -0
  56. data/app/views/layouts/egov_utils/application.html.erb +14 -0
  57. data/config/kraj.csv +16 -0
  58. data/config/locales/cs.yml +80 -0
  59. data/config/okres.csv +79 -0
  60. data/config/routes.rb +21 -0
  61. data/db/migrate/20170313100505_create_egov_utils_addresses.rb +18 -0
  62. data/db/migrate/20170315134217_create_egov_utils_users.rb +16 -0
  63. data/db/migrate/20170513115712_create_egov_utils_audit_records.rb_bac +11 -0
  64. data/db/migrate/20170513120006_create_egov_utils_audit_details.rb_bac +13 -0
  65. data/db/migrate/20170630150633_add_provider_to_user.rb +5 -0
  66. data/db/migrate/20170801154511_install_audited.rb +30 -0
  67. data/db/migrate/20170809150646_create_egov_utils_people.rb +12 -0
  68. data/db/migrate/20170824111701_create_egov_utils_groups.rb +12 -0
  69. data/lib/bootstrap_form/datetimepicker.rb +17 -0
  70. data/lib/bootstrap_form/helpers/bootstrap4.rb +12 -0
  71. data/lib/egov_utils/auth_source.rb +326 -0
  72. data/lib/egov_utils/engine.rb +84 -0
  73. data/lib/egov_utils/has_audit_trail.rb +68 -0
  74. data/lib/egov_utils/user_utils/application_controller_patch.rb +92 -0
  75. data/lib/egov_utils/user_utils/role.rb +26 -0
  76. data/lib/egov_utils/version.rb +3 -0
  77. data/lib/egov_utils.rb +5 -0
  78. data/lib/grid/shield_grid.rb +9 -0
  79. data/lib/tasks/egov_utils_tasks.rake +4 -0
  80. metadata +306 -0
@@ -0,0 +1,62 @@
1
+ = bootstrap_form_for(:search, url: search_users_path(format: :json), html: {id: 'user_search_form'}) do |f|
2
+ = f.text_field(:q, id: 'search_q')
3
+ = f.submit
4
+
5
+ %table.table#users_results
6
+ %thead
7
+ %tr
8
+ %th= EgovUtils::User.human_attribute_name('login')
9
+ %th= EgovUtils::User.human_attribute_name('fullname')
10
+ %th= t(:label_actions)
11
+ %tbody
12
+ %table.table#groups_results
13
+ %thead
14
+ %tr
15
+ %th= EgovUtils::Group.human_attribute_name('name')
16
+ %th= t(:label_actions)
17
+ %tbody
18
+
19
+ %h5= EgovUtils::User.model_name.human(count: :other)
20
+ %table.table#users
21
+ %thead
22
+ %tr
23
+ %th= t('model_attributes.user.fullname')
24
+ %th Akce
25
+ %tbody
26
+ - EgovUtils::User.all.each do |user|
27
+ %tr
28
+ %td= user.fullname
29
+ %td
30
+ - unless user.active?
31
+ = button_to(t('label_approve'), approve_user_path(user), class: 'btn btn-primary btn-sm')
32
+
33
+ :javascript
34
+ $('#user_search_form').on('submit', function(evt) {
35
+ evt.preventDefault();
36
+ $form = $(this);
37
+ $.ajax(this.action, {method: 'GET', data: {q: $('#search_q').val()}}).done(function(data, status, xhr){
38
+ $.each(['users', 'groups'], function(i, type) {
39
+ var tbl = $('#'+type+'_results tbody');
40
+ tbl.html('');
41
+ $.each(data[type], function(i, entity_data) {
42
+ var str, data_key, path, req_data;
43
+ if( type == 'users' ) {
44
+ str = '<td title="'+entity_data.dn.replace(/"/g, "&quot;")+'">'+entity_data.login+'</td><td>'+entity_data.firstname + ' ' + entity_data.lastname +'</td>';
45
+ req_data = {user: entity_data};
46
+ path = '#{users_path(format: :json)}';
47
+ } else {
48
+ str = '<td title="'+entity_data.dn.replace(/"/g, "&quot;")+'">'+entity_data.name+'</td>';
49
+ req_data = {group: entity_data};
50
+ path = '#{groups_path(format: :json)}';
51
+ }
52
+
53
+ $('<tr>' + str + '<td><button class="btn btn-primary add-button">Add</button></td></tr>').
54
+ appendTo(tbl).on('click', '.add-button', function(evt){
55
+ evt.preventDefault();
56
+ $.ajax(path, {method: 'POST', data: req_data});
57
+ });
58
+ });
59
+ });
60
+ $form.find('input[type="submit"]').prop('disabled', false);
61
+ });
62
+ });
@@ -0,0 +1,3 @@
1
+ = bootstrap_form_for(@user) do |f|
2
+ = render 'form', form: f
3
+ = f.submit
@@ -0,0 +1 @@
1
+ = current_user.fullname
@@ -0,0 +1 @@
1
+ Forbidden
@@ -0,0 +1,7 @@
1
+ -# Rails flash messages styled for Zurb Foundation
2
+ - flash.each do |name, msg|
3
+ - if msg.is_a?(String)
4
+ %div{:class => "alert alert-#{name.to_s == 'notice' ? "info" : "alert"} alert-dismissible fade show", "role" => "alert"}
5
+ %button.close{'type' => 'button', 'data-dissmis' => 'alert'}
6
+ %span{'aria-hidden' => 'true'}= raw '&times;'
7
+ = msg
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Egov utils</title>
5
+ <%= stylesheet_link_tag "egov_utils/application", media: "all" %>
6
+ <%= javascript_include_tag "egov_utils/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/kraj.csv ADDED
@@ -0,0 +1,16 @@
1
+ KOD;NAZEV;REGSOUDR_KOD;NUTS_LAU;PLATI_OD;PLATI_DO;DATUM_VZNIKU
2
+ 19;Hlavní město Praha;19;CZ010;23.11.2016 00:00:00;;01.01.2000 00:00:00
3
+ 116;Jihomoravský kraj;60;CZ064;24.05.2017 00:00:00;;01.01.2000 00:00:00
4
+ 35;Jihočeský kraj;35;CZ031;29.05.2017 00:00:00;;01.01.2000 00:00:00
5
+ 51;Karlovarský kraj;43;CZ041;29.03.2017 00:00:00;;01.01.2000 00:00:00
6
+ 108;Kraj Vysočina;60;CZ063;03.02.2017 00:00:00;;01.01.2000 00:00:00
7
+ 86;Královéhradecký kraj;51;CZ052;07.04.2017 00:00:00;;01.01.2000 00:00:00
8
+ 78;Liberecký kraj;51;CZ051;03.06.2016 00:00:00;;01.01.2000 00:00:00
9
+ 132;Moravskoslezský kraj;86;CZ080;13.12.2016 00:00:00;;01.01.2000 00:00:00
10
+ 124;Olomoucký kraj;78;CZ071;24.05.2017 00:00:00;;01.01.2000 00:00:00
11
+ 94;Pardubický kraj;51;CZ053;30.03.2017 00:00:00;;01.01.2000 00:00:00
12
+ 43;Plzeňský kraj;35;CZ032;05.12.2016 00:00:00;;01.01.2000 00:00:00
13
+ 27;Středočeský kraj;27;CZ020;03.02.2017 00:00:00;;01.01.2000 00:00:00
14
+ 141;Zlínský kraj;78;CZ072;07.03.2017 00:00:00;;01.01.2000 00:00:00
15
+ 60;Ústecký kraj;43;CZ042;16.12.2016 00:00:00;;01.01.2000 00:00:00
16
+
@@ -0,0 +1,80 @@
1
+ ---
2
+ cs:
3
+ ministery_justice_name: Ministerstvo spravedlnosti ČR
4
+ label_no_records: Žádné záznamy k zobrazení
5
+
6
+ notice_account_invalid_credentials: Přihlašovací údaje jsou nesprávné
7
+ notice_onthefly_failure: Nemáte oprávnění k přístupu do aplikace
8
+ notice_account_pending: Váš přístup čeká na schválení správce aplikace
9
+ notice_account_locked: Váš účet byl uzamčen správcem aplikace
10
+ notice_logout: Byl/a jste úspěšně odhlášen/a
11
+
12
+ label_approve: Schválit
13
+
14
+ common_labels:
15
+ new_record: "Nový %{model}"
16
+
17
+
18
+
19
+ models: &my_models
20
+ egov_utils::user:
21
+ one: Uživatel
22
+ others: Uživatelé
23
+ egov_utils::group:
24
+ one: Skupina
25
+ others: Skupiny
26
+ egov_utils::address:
27
+ one: Adresa
28
+ other: Adresy
29
+
30
+ model_attributes: &my_attributes
31
+ egov_utils/address:
32
+ street: Ulice
33
+ number: "Č.p./Č.o."
34
+ house_number: Č. popisné
35
+ orientation_number: Č. orientační
36
+ city: Obec
37
+ postcode: PSČ
38
+ district: Okres
39
+ region: Kraj
40
+ country: Země
41
+
42
+
43
+ models_errors: &my_model_errors
44
+ profile:
45
+ too_many_authors: Příliš mnoho autorů
46
+
47
+ labels: &my_labels
48
+ user:
49
+ password: Heslo
50
+ session:
51
+ username: Přihlášení
52
+ password: Heslo
53
+
54
+ activerecord:
55
+ models:
56
+ <<: *my_models
57
+ attributes:
58
+ <<: *my_attributes
59
+ errors:
60
+ models:
61
+ <<: *my_model_errors
62
+ messages:
63
+ record_invalid: 'Validace je neúspešná: %{errors}'
64
+ restrict_dependent_destroy:
65
+ has_one: Nemůžu smazat položku protože existuje závislá/ý/é %{record}
66
+ has_many: Nemůžu smazat položku protože existuje závislé/ý %{record}
67
+ successful:
68
+ messages:
69
+ created: "%{model} úspěšně vytvořen"
70
+ updated: "%{model} úspěšně aktualizován"
71
+
72
+ helpers:
73
+ label:
74
+ <<: *my_labels
75
+
76
+
77
+ errors:
78
+ messages:
79
+ ico_format: Není správný formát IČO
80
+ email_format: není e-mail
data/config/okres.csv ADDED
@@ -0,0 +1,79 @@
1
+ KOD;NAZEV;VUSC_KOD;KRAJ_1960_KOD;NUTS_LAU;PLATI_OD;PLATI_DO;DATUM_VZNIKU
2
+ 3201;Benešov;27;32;CZ0201;08.03.2017 00:00:00;;11.04.1960 00:00:00
3
+ 3202;Beroun;27;32;CZ0202;22.03.2017 00:00:00;;11.04.1960 00:00:00
4
+ 3701;Blansko;116;37;CZ0641;24.05.2017 00:00:00;;11.04.1960 00:00:00
5
+ 3702;Brno-město;116;37;CZ0642;17.03.2017 00:00:00;;11.04.1960 00:00:00
6
+ 3703;Brno-venkov;116;37;CZ0643;17.03.2017 00:00:00;;11.04.1960 00:00:00
7
+ 3801;Bruntál;132;38;CZ0801;13.12.2016 00:00:00;;11.04.1960 00:00:00
8
+ 3704;Břeclav;116;37;CZ0644;06.06.2015 00:00:00;;11.04.1960 00:00:00
9
+ 3402;Cheb;51;34;CZ0411;25.10.2016 00:00:00;;11.04.1960 00:00:00
10
+ 3503;Chomutov;60;35;CZ0422;11.05.2017 00:00:00;;11.04.1960 00:00:00
11
+ 3603;Chrudim;94;36;CZ0531;29.03.2017 00:00:00;;11.04.1960 00:00:00
12
+ 3401;Domažlice;43;34;CZ0321;31.05.2017 00:00:00;;11.04.1960 00:00:00
13
+ 3502;Děčín;60;35;CZ0421;27.12.2016 00:00:00;;11.04.1960 00:00:00
14
+ 3802;Frýdek-Místek;132;38;CZ0802;27.04.2017 00:00:00;;11.04.1960 00:00:00
15
+ 3601;Havlíčkův Brod;108;36;CZ0631;08.02.2017 00:00:00;;11.04.1960 00:00:00
16
+ 3100;Hlavní město Praha;19;31;CZ0100;23.11.2016 00:00:00;;11.04.1960 00:00:00
17
+ 3706;Hodonín;116;37;CZ0645;25.04.2017 00:00:00;;11.04.1960 00:00:00
18
+ 3602;Hradec Králové;86;36;CZ0521;06.04.2017 00:00:00;;11.04.1960 00:00:00
19
+ 3504;Jablonec nad Nisou;78;35;CZ0512;21.06.2016 00:00:00;;11.04.1960 00:00:00
20
+ 3811;Jeseník;124;38;CZ0711;31.05.2016 00:00:00;;01.01.1996 00:00:00
21
+ 3707;Jihlava;108;37;CZ0632;29.05.2017 00:00:00;;11.04.1960 00:00:00
22
+ 3303;Jindřichův Hradec;35;33;CZ0313;06.01.2017 00:00:00;;11.04.1960 00:00:00
23
+ 3604;Jičín;86;36;CZ0522;22.12.2016 00:00:00;;11.04.1960 00:00:00
24
+ 3403;Karlovy Vary;51;34;CZ0412;21.10.2016 00:00:00;;11.04.1960 00:00:00
25
+ 3803;Karviná;132;38;CZ0803;31.03.2016 00:00:00;;11.04.1960 00:00:00
26
+ 3203;Kladno;27;32;CZ0203;21.03.2017 00:00:00;;11.04.1960 00:00:00
27
+ 3404;Klatovy;43;34;CZ0322;31.05.2017 00:00:00;;11.04.1960 00:00:00
28
+ 3204;Kolín;27;32;CZ0204;30.05.2017 00:00:00;;11.04.1960 00:00:00
29
+ 3708;Kroměříž;141;37;CZ0721;15.05.2017 00:00:00;;11.04.1960 00:00:00
30
+ 3205;Kutná Hora;27;32;CZ0205;30.05.2017 00:00:00;;11.04.1960 00:00:00
31
+ 3505;Liberec;78;35;CZ0513;21.06.2016 00:00:00;;11.04.1960 00:00:00
32
+ 3506;Litoměřice;60;35;CZ0423;21.03.2017 00:00:00;;11.04.1960 00:00:00
33
+ 3507;Louny;60;35;CZ0424;11.05.2017 00:00:00;;11.04.1960 00:00:00
34
+ 3207;Mladá Boleslav;27;32;CZ0207;10.04.2017 00:00:00;;11.04.1960 00:00:00
35
+ 3508;Most;60;35;CZ0425;06.12.2016 00:00:00;;11.04.1960 00:00:00
36
+ 3206;Mělník;27;32;CZ0206;16.12.2016 00:00:00;;11.04.1960 00:00:00
37
+ 3804;Nový Jičín;132;38;CZ0804;13.04.2017 00:00:00;;11.04.1960 00:00:00
38
+ 3208;Nymburk;27;32;CZ0208;22.12.2016 00:00:00;;11.04.1960 00:00:00
39
+ 3605;Náchod;86;36;CZ0523;27.03.2017 00:00:00;;11.04.1960 00:00:00
40
+ 3805;Olomouc;124;38;CZ0712;15.05.2017 00:00:00;;11.04.1960 00:00:00
41
+ 3806;Opava;132;38;CZ0805;01.11.2016 00:00:00;;11.04.1960 00:00:00
42
+ 3807;Ostrava-město;132;38;CZ0806;27.04.2017 00:00:00;;11.04.1960 00:00:00
43
+ 3606;Pardubice;94;36;CZ0532;29.03.2017 00:00:00;;11.04.1960 00:00:00
44
+ 3304;Pelhřimov;108;33;CZ0633;27.03.2017 00:00:00;;11.04.1960 00:00:00
45
+ 3406;Plzeň-jih;43;34;CZ0324;29.03.2017 00:00:00;;11.04.1960 00:00:00
46
+ 3405;Plzeň-město;43;34;CZ0323;28.03.2017 00:00:00;;11.04.1960 00:00:00
47
+ 3407;Plzeň-sever;43;34;CZ0325;23.11.2016 00:00:00;;11.04.1960 00:00:00
48
+ 3306;Prachatice;35;33;CZ0315;29.05.2017 00:00:00;;11.04.1960 00:00:00
49
+ 3209;Praha-východ;27;32;CZ0209;22.11.2016 00:00:00;;11.04.1960 00:00:00
50
+ 3210;Praha-západ;27;32;CZ020A;22.03.2017 00:00:00;;11.04.1960 00:00:00
51
+ 3709;Prostějov;124;37;CZ0713;24.05.2017 00:00:00;;11.04.1960 00:00:00
52
+ 3305;Písek;35;33;CZ0314;11.12.2016 00:00:00;;11.04.1960 00:00:00
53
+ 3808;Přerov;124;38;CZ0714;16.12.2016 00:00:00;;11.04.1960 00:00:00
54
+ 3211;Příbram;27;32;CZ020B;09.06.2016 00:00:00;;11.04.1960 00:00:00
55
+ 3212;Rakovník;27;32;CZ020C;13.07.2016 00:00:00;;11.04.1960 00:00:00
56
+ 3408;Rokycany;43;34;CZ0326;29.03.2017 00:00:00;;11.04.1960 00:00:00
57
+ 3607;Rychnov nad Kněžnou;86;36;CZ0524;06.04.2017 00:00:00;;11.04.1960 00:00:00
58
+ 3608;Semily;78;36;CZ0514;04.06.2016 00:00:00;;11.04.1960 00:00:00
59
+ 3409;Sokolov;51;34;CZ0413;29.03.2017 00:00:00;;11.04.1960 00:00:00
60
+ 3307;Strakonice;35;33;CZ0316;02.05.2017 00:00:00;;11.04.1960 00:00:00
61
+ 3609;Svitavy;94;36;CZ0533;30.03.2017 00:00:00;;11.04.1960 00:00:00
62
+ 3410;Tachov;43;34;CZ0327;12.04.2017 00:00:00;;11.04.1960 00:00:00
63
+ 3509;Teplice;60;35;CZ0426;20.09.2016 00:00:00;;11.04.1960 00:00:00
64
+ 3610;Trutnov;86;36;CZ0525;29.11.2016 00:00:00;;11.04.1960 00:00:00
65
+ 3308;Tábor;35;33;CZ0317;08.03.2017 00:00:00;;11.04.1960 00:00:00
66
+ 3710;Třebíč;108;37;CZ0634;29.05.2017 00:00:00;;11.04.1960 00:00:00
67
+ 3711;Uherské Hradiště;141;37;CZ0722;25.04.2017 00:00:00;;11.04.1960 00:00:00
68
+ 3810;Vsetín;141;38;CZ0723;21.09.2016 00:00:00;;11.04.1960 00:00:00
69
+ 3712;Vyškov;116;37;CZ0646;28.03.2017 00:00:00;;11.04.1960 00:00:00
70
+ 3705;Zlín;141;37;CZ0724;15.05.2017 00:00:00;;11.04.1960 00:00:00
71
+ 3713;Znojmo;116;37;CZ0647;01.12.2016 00:00:00;;11.04.1960 00:00:00
72
+ 3809;Šumperk;124;38;CZ0715;23.02.2017 00:00:00;;11.04.1960 00:00:00
73
+ 3714;Žďár nad Sázavou;108;37;CZ0635;08.02.2017 00:00:00;;11.04.1960 00:00:00
74
+ 3501;Česká Lípa;78;35;CZ0511;10.04.2017 00:00:00;;11.04.1960 00:00:00
75
+ 3301;České Budějovice;35;33;CZ0311;16.02.2017 00:00:00;;11.04.1960 00:00:00
76
+ 3302;Český Krumlov;35;33;CZ0312;16.02.2017 00:00:00;;11.04.1960 00:00:00
77
+ 3510;Ústí nad Labem;60;35;CZ0427;20.09.2016 00:00:00;;11.04.1960 00:00:00
78
+ 3611;Ústí nad Orlicí;94;36;CZ0534;29.03.2017 00:00:00;;11.04.1960 00:00:00
79
+
data/config/routes.rb ADDED
@@ -0,0 +1,21 @@
1
+ EgovUtils::Engine.routes.draw do
2
+
3
+ get '/login', to: 'sessions#new', as: 'signin'
4
+ post '/login', to: 'sessions#create'
5
+ delete '/logout', to: 'sessions#destroy', as: 'signout'
6
+
7
+ resources :sessions
8
+ resources :users do
9
+ get :search, on: :collection
10
+ post :approve, on: :member
11
+ end
12
+
13
+ resources :groups
14
+ resources :roles
15
+
16
+ # post '/auth/:provider/callback', to: 'sessions#create'
17
+
18
+ get '/address/validate_ruian' => 'addresses#validate_ruian', as: :validate_ruian
19
+
20
+
21
+ end
@@ -0,0 +1,18 @@
1
+ class CreateEgovUtilsAddresses < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :egov_utils_addresses do |t|
4
+ t.integer :egov_identifier
5
+ t.string :street
6
+ t.string :house_number
7
+ t.string :orientation_number
8
+ t.string :city
9
+ t.string :city_part
10
+ t.string :postcode
11
+ t.string :district
12
+ t.string :region
13
+ t.string :country
14
+
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ class CreateEgovUtilsUsers < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :egov_utils_users do |t|
4
+ t.string :login
5
+ t.string :mail
6
+ t.string :password_digest
7
+ t.string :firstname
8
+ t.string :lastname
9
+ t.boolean :active, default: false
10
+ t.string :roles
11
+ t.datetime :last_login_at
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ class CreateEgovUtilsAuditRecords < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :egov_utils_audit_records do |t|
4
+ t.references :audited, foreign_key: true
5
+ t.references :user, foreign_key: true
6
+ t.text :notes
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class CreateEgovUtilsAuditDetails < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :egov_utils_audit_details do |t|
4
+ t.references :audit_record, foreign_key: true
5
+ t.string :property
6
+ t.string :prop_key
7
+ t.text :old_value
8
+ t.text :value
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class AddProviderToUser < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :egov_utils_users, :provider, :string
4
+ end
5
+ end
@@ -0,0 +1,30 @@
1
+ class InstallAudited < ActiveRecord::Migration[5.1]
2
+ def self.up
3
+ create_table :audits, :force => true do |t|
4
+ t.column :auditable_id, :integer
5
+ t.column :auditable_type, :string
6
+ t.column :associated_id, :integer
7
+ t.column :associated_type, :string
8
+ t.column :user_id, :integer
9
+ t.column :user_type, :string
10
+ t.column :username, :string
11
+ t.column :action, :string
12
+ t.column :audited_changes, :text
13
+ t.column :version, :integer, :default => 0
14
+ t.column :comment, :string
15
+ t.column :remote_address, :string
16
+ t.column :request_uuid, :string
17
+ t.column :created_at, :datetime
18
+ end
19
+
20
+ add_index :audits, [:auditable_id, :auditable_type], :name => 'auditable_index'
21
+ add_index :audits, [:associated_id, :associated_type], :name => 'associated_index'
22
+ add_index :audits, [:user_id, :user_type], :name => 'user_index'
23
+ add_index :audits, :request_uuid
24
+ add_index :audits, :created_at
25
+ end
26
+
27
+ def self.down
28
+ drop_table :audits
29
+ end
30
+ end
@@ -0,0 +1,12 @@
1
+ class CreateEgovUtilsPeople < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :egov_utils_people do |t|
4
+ t.string :firstname
5
+ t.string :lastname
6
+ t.date :birth_date
7
+ t.string :external_uid
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ class CreateEgovUtilsGroups < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :egov_utils_groups do |t|
4
+ t.string :name
5
+ t.string :provider
6
+ t.string :roles
7
+ t.string :ldap_uid
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ module BootstrapForm
2
+ module Datetimepicker
3
+ def date_field(name, *args)
4
+ options = args.extract_options!.symbolize_keys!
5
+ options[:data] = {provide: 'datepicker', 'date-format' => 'L'}.merge(options[:data] || {})
6
+ args << options
7
+ super
8
+ end
9
+
10
+ def datetime_field(name, *args)
11
+ options = args.extract_options!.symbolize_keys!
12
+ options[:data] = {provide: 'datepicker'}.merge(options[:data] || {})
13
+ args << options
14
+ super
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ module BootstrapForm
2
+ module Helpers
3
+ module Bootstrap4
4
+
5
+ def submit(name = nil, options = {})
6
+ options.reverse_merge! class: 'btn btn-secondary'
7
+ super(name, options)
8
+ end
9
+
10
+ end
11
+ end
12
+ end