egov_utils 1.2.4 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41e5e8f0fddbd48afc8de52397c54112e05b6bdab136dcc6b47cdf6591192af9
4
- data.tar.gz: 153fe8400cbc5054d67ede4ad80baab8c4c5c2b36d9d9195e851e077219f98e0
3
+ metadata.gz: 8f0a5aac085108bad75499b396f611a9c5b91608f2f5db34dee6c1d12ca5a0d2
4
+ data.tar.gz: b87be337d3c809736b4dcd02e57dd1d6983067bfcb9a8f0428e25e2ed89b6257
5
5
  SHA512:
6
- metadata.gz: 0d05de0762d92b03dd8c1437ea176030976cf3f9e78ae732b91859cc934b9a0b7de3f9a78e08f622870c2568966c02fca953c54d364ba95785c452f241f710b5
7
- data.tar.gz: fffee71ae833b7930c9ec2706bdebc9aaa01c8670063409055f8703e3e6e0389b8228e3122ac87e15e69dbc7134d4f000381b822e7b16c8112546484083f42bc
6
+ metadata.gz: a61664e8179f266af435cf10c6edfbccb7b0ab0717289f9e1ffa0915b58e02df9fc192a96e1a09bba42310ccc681930a419a3043e162d7c8cefb511389de4ce1
7
+ data.tar.gz: d54bb74ce6c19c7c3c828a6fe4ef832d06f4c10f017981b9b353fde4f0dd661b5bafbc093b8dd07e501ffc4c61c8e6553e500a430ccf83938a87ebc7223820d7
@@ -48,13 +48,18 @@ module EgovUtils
48
48
  params
49
49
  .require(:registration_requests_create)
50
50
  .permit(:mail, :firstname, :lastname, :organization, :note,
51
- :supervisor_name, :supervisor_phone, :supervisor_email)
51
+ :supervisor_name, :supervisor_phone, :supervisor_email,
52
+ :supervisor_assignment)
52
53
  end
53
54
 
54
55
  def update_params
55
56
  params
56
57
  .require(:registration_request)
57
- .permit(:status, :reason, :internal_reason, roles: [])
58
+ .permit(:status, :reason, :internal_reason, roles: [], group_ids: [])
59
+ .tap do |p|
60
+ p[:roles] = p[:roles].reject(&:blank?)
61
+ p[:group_ids] = p[:group_ids].reject(&:blank?)
62
+ end
58
63
  end
59
64
  end
60
65
  end
@@ -4,7 +4,7 @@ module EgovUtils
4
4
  :supervisor_name, presence: true
5
5
  validate :check_user_already_exists!
6
6
 
7
- attr_accessor :roles
7
+ attr_accessor :roles, :group_ids
8
8
 
9
9
  def fullname
10
10
  "#{firstname} #{lastname}"
@@ -2,7 +2,7 @@ module EgovUtils
2
2
  class RefreshGroups
3
3
 
4
4
  def call
5
- hsh = groups.each_with_object({}) do |group, memo|
5
+ hsh = remote_groups.each_with_object({}) do |group, memo|
6
6
  infos = group.ldap_members
7
7
  infos.each do |info|
8
8
  memo[info] ||= []
@@ -11,17 +11,19 @@ module EgovUtils
11
11
  end
12
12
 
13
13
  hsh.each do |info, groups|
14
- user = EgovUtils::User.find_by(login: info[:login])
14
+ user = EgovUtils::User.where("login ILIKE ?", info[:login]).first
15
15
  next unless user
16
16
 
17
17
  all_groups = user.groups.where(ldap_uid: nil) + groups
18
- user.update(info.merge(groups: all_groups))
18
+ info[:login] = info[:login].downcase
19
+ info[:mail] = info[:mail].downcase
20
+ user.update(info.except(:dn).merge(groups: all_groups))
19
21
  end
20
22
  end
21
23
 
22
24
  private
23
25
 
24
- def groups
26
+ def remote_groups
25
27
  EgovUtils::Group.where.not(ldap_uid: nil)
26
28
  end
27
29
  end
@@ -9,6 +9,7 @@ module EgovUtils
9
9
  string :supervisor_name
10
10
  string :supervisor_phone
11
11
  string :supervisor_email
12
+ string :supervisor_assignment
12
13
 
13
14
  def execute
14
15
  request = RegistrationRequest.create(inputs.merge(status: :pending))
@@ -8,6 +8,9 @@ module EgovUtils
8
8
  array :roles, default: [] do
9
9
  string
10
10
  end
11
+ array :group_ids, default: [] do
12
+ integer
13
+ end
11
14
 
12
15
  def execute
13
16
  registration_request.update(
@@ -34,14 +37,15 @@ module EgovUtils
34
37
  private
35
38
 
36
39
  def create_user!
37
- user = User.create(
40
+ User.create(
38
41
  mail: registration_request.mail,
39
42
  login: registration_request.mail,
40
43
  firstname: registration_request.firstname,
41
44
  lastname: registration_request.lastname,
42
45
  password: password,
43
46
  password_confirmation: password,
44
- roles: roles.compact_blank,
47
+ roles: roles,
48
+ group_ids: group_ids,
45
49
  must_change_password: true,
46
50
  active: true,
47
51
  last_login_at: Time.current
@@ -54,4 +58,3 @@ module EgovUtils
54
58
  end
55
59
  end
56
60
  end
57
-
@@ -1,4 +1,3 @@
1
- = form.text_field(:name)
2
1
  = bootstrap_form_for(@group) do |f|
3
2
  = f.text_field :name
4
3
  = f.collection_check_boxes :roles, EgovUtils::UserUtils::Role.roles, :first, ->(role) { I18n.t("roles.#{role.first}") }
@@ -10,6 +10,7 @@
10
10
  %h2= t('.supervisor')
11
11
  %em= t('.supervisor_info')
12
12
  = f.text_field(:supervisor_name)
13
+ = f.text_field(:supervisor_assignment)
13
14
  = f.text_field(:supervisor_email)
14
15
  = f.text_field(:supervisor_phone)
15
16
  = f.submit t(:label_registration_request)
@@ -20,6 +20,9 @@
20
20
  %tr
21
21
  %th= EgovUtils::RegistrationRequest.human_attribute_name('supervisor_name')
22
22
  %td= @registration_request.supervisor_name
23
+ %tr
24
+ %th= EgovUtils::RegistrationRequest.human_attribute_name('supervisor_assignment')
25
+ %td= @registration_request.supervisor_assignment
23
26
  %tr
24
27
  %th= EgovUtils::RegistrationRequest.human_attribute_name('supervisor_email')
25
28
  %td= @registration_request.supervisor_email
@@ -42,18 +45,27 @@
42
45
 
43
46
  - if @registration_request.status == 'pending'
44
47
  = bootstrap_form_for(@registration_request, url: '#') do |f|
48
+ = f.collection_radio_buttons :status, ['accepted', 'rejected'], :itself, ->(status) { t(".decision_status.#{status}") }, label: t('.decision')
49
+
45
50
  = f.text_area(:reason)
46
51
  = f.text_area(:internal_reason)
47
- = f.hidden_field(:status, value: nil)
48
- = f.collection_check_boxes :roles, EgovUtils::UserUtils::Role.roles, :first, ->(role) { I18n.t("roles.#{role.first}") }
49
52
 
50
- = f.submit t('.accept'), class: 'btn btn-success', data: { value: 'accepted' }
51
- = f.submit t('.reject'), class: 'btn btn-danger', data: { value: 'rejected' }
53
+ #roles-groups.d-none
54
+ = f.collection_check_boxes :roles, EgovUtils::UserUtils::Role.roles, :first, ->(role) { I18n.t("roles.#{role.first}") }
55
+ = f.collection_check_boxes :group_ids, EgovUtils::Group.where(ldap_uid: nil), :id, :name
56
+
57
+ = f.submit t('.save'), class: 'btn btn-primary'
52
58
 
53
59
  :javascript
54
60
  $(function() {
55
- $('input[type=submit]').click(function(e) {
56
- var status = $(this).data('value');
57
- $('#registration_request_status').val(status);
61
+ $('input[type=radio]').click(function(e) {
62
+ var status = $(this).val();
63
+
64
+ console.log(status)
65
+ if (status === 'accepted') {
66
+ $('#roles-groups').removeClass('d-none');
67
+ } else {
68
+ $('#roles-groups').addClass('d-none');
69
+ }
58
70
  });
59
71
  });
@@ -48,7 +48,7 @@ cs:
48
48
  warning_password_not_changed: Heslo nebylo změněno, zadali jste všechna hesla správně?
49
49
 
50
50
 
51
- label_approve: Schválit
51
+ label_approve: Aktivovat
52
52
  label_new: Nový
53
53
  label_create: Vytvořit
54
54
  label_edit: Upravit
@@ -154,8 +154,11 @@ cs:
154
154
  reason: Odůvodnění
155
155
  internal_reason: Interní poznámka
156
156
  supervisor_name: 'Jméno schvalující osoby'
157
+ supervisor_assignment: 'Funkce schvalující osoby'
157
158
  supervisor_email: 'Kontaktní e-mail schvalující osoby'
158
159
  supervisor_phone: 'Kontaktní telefon na schvalující osobu'
160
+ roles: Role
161
+ groups: Skupiny
159
162
  active_interaction:
160
163
  attributes:
161
164
  egov_utils/registration_requests/create:
@@ -170,6 +173,7 @@ cs:
170
173
  reason: Odůvodnění
171
174
  internal_reason: Interní poznámka
172
175
  supervisor_name: 'Jméno schvalující osoby'
176
+ supervisor_assignment: 'Funkce schvalující osoby'
173
177
  supervisor_email: 'Kontaktní e-mail schvalující osoby'
174
178
  supervisor_phone: 'Kontaktní telefon na schvalující osobu'
175
179
 
@@ -266,8 +270,11 @@ cs:
266
270
  title: 'Žádosti o přístup do aplikace'
267
271
  show:
268
272
  title: 'Žádost o registraci - %{name}'
269
- accept: 'Přijmout žádost'
270
- reject: 'Odmítnout žádost'
273
+ decision: 'Rozhodnutí'
274
+ decision_status:
275
+ accepted: 'Přijmout žádost'
276
+ rejected: 'Odmítnout žádost'
277
+ save: 'Potvrdit'
271
278
  sessions:
272
279
  new:
273
280
  registration_request: 'Žádost o registraci'
@@ -0,0 +1,7 @@
1
+ class AddSupervisorAssignmentToRegistrationRequests < ActiveRecord::Migration[6.1]
2
+ def change
3
+ add_column :egov_utils_registration_requests,
4
+ :supervisor_assignment,
5
+ :string
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '1.2.4'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egov_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-09 00:00:00.000000000 Z
11
+ date: 2023-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -655,6 +655,7 @@ files:
655
655
  - db/migrate/20230408123813_create_egov_utils_registration_requests.rb
656
656
  - db/migrate/20230412063325_add_days_before_archive_to_egov_utils_users.rb
657
657
  - db/migrate/20230427091407_add_fields_to_registration_requests.rb
658
+ - db/migrate/20231006131159_add_supervisor_assignment_to_registration_requests.rb
658
659
  - lib/azahara_schema_currency.rb
659
660
  - lib/azahara_schema_currency/aggregation_attribute_patch.rb
660
661
  - lib/azahara_schema_currency/association_attribute_patch.rb