egov_utils 1.1.1 → 1.2.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/egov_utils/current_users_controller.rb +26 -0
- data/app/controllers/egov_utils/groups_controller.rb +33 -7
- data/app/controllers/egov_utils/passwords_controller.rb +4 -1
- data/app/controllers/egov_utils/registration_requests_controller.rb +59 -0
- data/app/controllers/egov_utils/users_controller.rb +56 -33
- data/app/jobs/egov_utils/registration_requests/check_auto_accept_job.rb +12 -0
- data/app/mailers/egov_utils/registration_request_mailer.rb +31 -0
- data/app/models/egov_utils/group.rb +1 -3
- data/app/models/egov_utils/registration_request.rb +21 -0
- data/app/models/egov_utils/user.rb +12 -0
- data/app/services/egov_utils/archive_users.rb +12 -0
- data/app/services/egov_utils/refresh_groups.rb +28 -0
- data/app/services/egov_utils/refresh_user_groups.rb +3 -4
- data/app/services/egov_utils/registration_requests/check_auto_accept.rb +31 -0
- data/app/services/egov_utils/registration_requests/create.rb +25 -0
- data/app/services/egov_utils/registration_requests/handle_request.rb +57 -0
- data/app/views/egov_utils/current_users/edit.html.haml +12 -0
- data/app/views/egov_utils/groups/_form.html.haml +5 -0
- data/app/views/egov_utils/groups/_groups_tab.html.haml +0 -5
- data/app/views/egov_utils/groups/edit.html.haml +4 -0
- data/app/views/egov_utils/groups/index.html.haml +28 -19
- data/app/views/egov_utils/groups/new.html.haml +4 -0
- data/app/views/egov_utils/registration_request_mailer/accepted.html.erb +12 -0
- data/app/views/egov_utils/registration_request_mailer/auto_accepted.html.erb +8 -0
- data/app/views/egov_utils/registration_request_mailer/created.html.erb +12 -0
- data/app/views/egov_utils/registration_request_mailer/rejected.html.erb +6 -0
- data/app/views/egov_utils/registration_requests/index.html.haml +29 -0
- data/app/views/egov_utils/registration_requests/new.html.haml +9 -0
- data/app/views/egov_utils/registration_requests/show.html.haml +51 -0
- data/app/views/egov_utils/sessions/new.html.haml +3 -0
- data/app/views/egov_utils/users/edit.html.haml +9 -0
- data/app/views/egov_utils/users/index.html.haml +42 -25
- data/config/locales/cs.yml +81 -3
- data/config/routes.rb +6 -1
- data/db/migrate/20230407114921_add_deleted_at_to_egov_utils_users.rb +6 -0
- data/db/migrate/20230408123813_create_egov_utils_registration_requests.rb +16 -0
- data/db/migrate/20230412063325_add_days_before_archive_to_egov_utils_users.rb +5 -0
- data/lib/egov_utils/version.rb +1 -1
- metadata +39 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0d959fdb236578d9d04f1828e69794d06ef9b7e03696f4459a714da45528180
|
4
|
+
data.tar.gz: c74d6584c3ca4ba356a236d81decd35e9d5a45b09f0b84048f2f32f2d95597ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d208c342267f541e57835573f28bb10f173592f87b2c0a7a96427c7398cfcd11b2984a1ba4770d67f1ef6be0b04e32edd0586b3f887d0e5b3b56711961afad94
|
7
|
+
data.tar.gz: 7e06bb6d70942d28fa90266e3b9aa5e4bc0c8bf3790989c934b385e5cafc9e95559af1beae42e189b9210b4a49360d6d28435d58f7a71e88a18259482ad7348b
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
class CurrentUsersController < ApplicationController
|
3
|
+
before_action :require_login
|
4
|
+
|
5
|
+
def edit; end
|
6
|
+
|
7
|
+
def update
|
8
|
+
current_user.update(update_params)
|
9
|
+
|
10
|
+
if current_user.valid?
|
11
|
+
redirect_to edit_current_user_path, notice: t('activerecord.successful.messages.updated', model: User.model_name.human)
|
12
|
+
else
|
13
|
+
render :edit
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def update_params
|
20
|
+
params
|
21
|
+
.require(:user)
|
22
|
+
.permit(:email, :password, :password_confirmation, :firstname,
|
23
|
+
:lastname)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -2,20 +2,36 @@ require_dependency "egov_utils/application_controller"
|
|
2
2
|
|
3
3
|
module EgovUtils
|
4
4
|
class GroupsController < ApplicationController
|
5
|
+
def index
|
6
|
+
@groups = EgovUtils::Group.
|
7
|
+
accessible_by(current_ability).
|
8
|
+
order(:provider).
|
9
|
+
page(params[:page] || 1)
|
10
|
+
end
|
5
11
|
|
6
|
-
|
12
|
+
def new
|
13
|
+
@group = Group.new
|
14
|
+
end
|
7
15
|
|
8
|
-
def
|
9
|
-
@
|
16
|
+
def edit
|
17
|
+
@group = Group.find(params[:id])
|
10
18
|
end
|
11
19
|
|
12
|
-
def
|
20
|
+
def update
|
21
|
+
@group = Group.find(params[:id])
|
22
|
+
|
23
|
+
if @group.update(update_params)
|
24
|
+
redirect_to egov_utils.groups_path, notice: t('success_updated')
|
25
|
+
else
|
26
|
+
render :edit
|
27
|
+
end
|
13
28
|
end
|
14
29
|
|
15
30
|
def create
|
31
|
+
@group = Group.new(create_params)
|
16
32
|
respond_to do |format|
|
17
33
|
if @group.save
|
18
|
-
format.html{ redirect_to egov_utils.
|
34
|
+
format.html{ redirect_to egov_utils.groups_path, notice: t('success_created') }
|
19
35
|
format.json{ render json: @group, status: :created }
|
20
36
|
else
|
21
37
|
format.html{ render 'new' }
|
@@ -44,9 +60,19 @@ module EgovUtils
|
|
44
60
|
|
45
61
|
private
|
46
62
|
|
47
|
-
|
48
|
-
|
63
|
+
def create_params
|
64
|
+
params
|
65
|
+
.require(:group)
|
66
|
+
.permit(:name, :provider, :ldap_uid, :external_uid, roles: []) do |p|
|
67
|
+
p[:roles] = p[:roles].compact_blank
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def update_params
|
72
|
+
params.require(:group).permit(:name, roles: []).tap do |p|
|
73
|
+
p[:roles] = p[:roles].compact_blank
|
49
74
|
end
|
75
|
+
end
|
50
76
|
|
51
77
|
end
|
52
78
|
end
|
@@ -18,8 +18,11 @@ module EgovUtils
|
|
18
18
|
if @user && @user.password_change_possible?
|
19
19
|
@token = @user.generate_reset_password_token
|
20
20
|
EgovUtils::UserMailer.with(host: mailer_host).password_reset(@user, @token).deliver_later if @user.save
|
21
|
+
flash[:notice] = t('notice_reset_email_sent')
|
22
|
+
elsif !@user.password_change_possible?
|
23
|
+
flash[:error] = t('notice_pw_reset_not_possible')
|
21
24
|
end
|
22
|
-
redirect_to egov_utils.reset_passwords_path
|
25
|
+
redirect_to egov_utils.reset_passwords_path
|
23
26
|
end
|
24
27
|
|
25
28
|
# New password for existing user - password reset
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
class RegistrationRequestsController < ApplicationController
|
3
|
+
before_action :find_registration_request, only: %i[show update]
|
4
|
+
before_action :require_login, except: %i[new create]
|
5
|
+
|
6
|
+
def index
|
7
|
+
@registration_requests =
|
8
|
+
RegistrationRequest.order(created_at: :desc).page(params[:page] || 1)
|
9
|
+
end
|
10
|
+
|
11
|
+
def show; end
|
12
|
+
|
13
|
+
def new
|
14
|
+
@registration_request = RegistrationRequest.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def create
|
18
|
+
@registration_request = RegistrationRequests::Create.run!(create_params)
|
19
|
+
if @registration_request.valid?
|
20
|
+
redirect_to egov_utils.new_session_path,
|
21
|
+
notice: I18n.t('registration_request.create.success')
|
22
|
+
else
|
23
|
+
render :new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def update
|
28
|
+
RegistrationRequests::HandleRequest.run!(
|
29
|
+
update_params.merge(registration_request: @registration_request)
|
30
|
+
)
|
31
|
+
|
32
|
+
if @registration_request.valid?
|
33
|
+
redirect_to @registration_request,
|
34
|
+
notice: I18n.t('registration_request.update.success')
|
35
|
+
else
|
36
|
+
render :show
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def find_registration_request
|
43
|
+
@registration_request = EgovUtils::RegistrationRequest.find(params[:id])
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_params
|
47
|
+
params
|
48
|
+
.require(:registration_request)
|
49
|
+
.permit(:mail, :firstname, :lastname, :organization, :note)
|
50
|
+
end
|
51
|
+
|
52
|
+
def update_params
|
53
|
+
params
|
54
|
+
.require(:registration_request)
|
55
|
+
.permit(:status, :reason, :internal_reason, roles: [])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
@@ -1,24 +1,28 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_dependency 'egov_utils/application_controller'
|
4
|
+
require_dependency 'egov_utils/auth_source'
|
3
5
|
|
4
6
|
module EgovUtils
|
5
7
|
class UsersController < ApplicationController
|
8
|
+
skip_before_action :require_login, only: %i[new create confirm edit update]
|
9
|
+
before_action :set_providers, only: %i[index search]
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
load_and_authorize_resource only: [:index, :new, :create, :show, :destroy, :edit, :update]
|
11
|
+
load_and_authorize_resource only: %i[index new create show destroy edit update]
|
10
12
|
|
11
13
|
def index
|
12
|
-
|
13
|
-
@groups = EgovUtils::Group.accessible_by(current_ability).order(:provider)
|
14
|
-
@new_user = EgovUtils::User.new(generate_password: true)
|
14
|
+
params[:default_scope] ||= :without_deleted
|
15
15
|
azahara_schema_index do |users|
|
16
16
|
users.add_sort('provider')
|
17
17
|
end
|
18
|
+
@entities =
|
19
|
+
@users.entities.includes(:groups).page(params[:page] || 1).per(50)
|
20
|
+
if params[:search]
|
21
|
+
@entities = @entities.search(params[:search])
|
22
|
+
end
|
18
23
|
end
|
19
24
|
|
20
|
-
def new
|
21
|
-
end
|
25
|
+
def new; end
|
22
26
|
|
23
27
|
def create
|
24
28
|
@user.mail ||= @user.login
|
@@ -34,25 +38,27 @@ module EgovUtils
|
|
34
38
|
end
|
35
39
|
flash[:notice] = t('activerecord.successful.messages.created', model: User.model_name.human)
|
36
40
|
end
|
37
|
-
format.html{ redirect_to main_app.root_path }
|
38
|
-
format.json{ render json: @user, status: :created }
|
41
|
+
format.html { redirect_to main_app.root_path }
|
42
|
+
format.json { render json: @user, status: :created }
|
39
43
|
else
|
40
|
-
format.html{ render 'new' }
|
41
|
-
format.json{ render json: @user.errors.full_messages, status: :unprocessable_entity }
|
44
|
+
format.html { render 'new' }
|
45
|
+
format.json { render json: @user.errors.full_messages, status: :unprocessable_entity }
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
|
-
def show
|
47
|
-
end
|
50
|
+
def show; end
|
48
51
|
|
49
|
-
def edit
|
50
|
-
end
|
52
|
+
def edit; end
|
51
53
|
|
52
54
|
def update
|
53
55
|
@user.update(update_params)
|
54
56
|
|
55
|
-
|
57
|
+
if @user.valid?
|
58
|
+
redirect_to users_path, notice: t('activerecord.successful.messages.updated', model: User.model_name.human)
|
59
|
+
else
|
60
|
+
render :edit
|
61
|
+
end
|
56
62
|
end
|
57
63
|
|
58
64
|
def destroy
|
@@ -81,29 +87,46 @@ module EgovUtils
|
|
81
87
|
authorize!(:read, User)
|
82
88
|
authorize!(:read, Group)
|
83
89
|
user_results = []; group_results = []
|
84
|
-
providers.each do |provider|
|
85
|
-
user_results.concat(
|
86
|
-
group_results.concat(
|
90
|
+
@providers.each do |provider|
|
91
|
+
user_results.concat(provider.search_user(params[:q]))
|
92
|
+
group_results.concat(provider.search_group(params[:q]))
|
87
93
|
end if params[:q].present?
|
88
94
|
respond_to do |format|
|
89
|
-
format.json
|
95
|
+
format.json do
|
96
|
+
render json: { users: user_results, groups: group_results }
|
97
|
+
end
|
90
98
|
end
|
91
99
|
end
|
92
100
|
|
101
|
+
def unarchive
|
102
|
+
user = User.with_deleted.find(params[:id])
|
103
|
+
user.restore
|
104
|
+
redirect_to users_path, notice: t('activerecord.successful.messages.unarchived', model: User.model_name.human)
|
105
|
+
end
|
106
|
+
|
93
107
|
private
|
94
108
|
|
95
|
-
|
96
|
-
|
109
|
+
def set_providers
|
110
|
+
@providers = EgovUtils::AuthSource.providers.map do |p|
|
111
|
+
EgovUtils::AuthSource.new(p)
|
97
112
|
end
|
113
|
+
end
|
98
114
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
115
|
+
def create_params
|
116
|
+
params_to_permit = %i[login mail password password_confirmation provider firstname lastname]
|
117
|
+
params_to_permit << :generate_password if current_user.logged?
|
118
|
+
params.require(:user).permit(*params_to_permit)
|
119
|
+
end
|
104
120
|
|
105
|
-
|
106
|
-
|
107
|
-
|
121
|
+
def update_params
|
122
|
+
params
|
123
|
+
.require(:user)
|
124
|
+
.permit(
|
125
|
+
:days_before_inactive, :days_before_archive, :password,
|
126
|
+
:password_confirmation, roles: []
|
127
|
+
).tap do |p|
|
128
|
+
p[:roles] = p[:roles].compact_blank
|
129
|
+
end
|
130
|
+
end
|
108
131
|
end
|
109
132
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
class RegistrationRequestMailer < ApplicationMailer
|
3
|
+
before_action { @host = params && params[:host] || Rails.application.config.action_mailer.default_url_options[:host] }
|
4
|
+
|
5
|
+
def created(request_id)
|
6
|
+
@request = EgovUtils::RegistrationRequest.find(request_id)
|
7
|
+
|
8
|
+
mail(to: @request.mail, subject: I18n.t('mailers.registration_requests.created.subject'))
|
9
|
+
end
|
10
|
+
|
11
|
+
def accepted(request_id, user_id, password)
|
12
|
+
@request = EgovUtils::RegistrationRequest.find(request_id)
|
13
|
+
@user = User.find(user_id)
|
14
|
+
@password = password
|
15
|
+
|
16
|
+
mail(to: @user.mail, subject: I18n.t('mailers.registration_requests.accepted.subject'))
|
17
|
+
end
|
18
|
+
|
19
|
+
def auto_accepted(request_id)
|
20
|
+
@request = EgovUtils::RegistrationRequest.find(request_id)
|
21
|
+
|
22
|
+
mail(to: @request.mail, subject: I18n.t('mailers.registration_requests.auto_accepted.subject'))
|
23
|
+
end
|
24
|
+
|
25
|
+
def rejected(request_id)
|
26
|
+
@request = EgovUtils::RegistrationRequest.find(request_id)
|
27
|
+
|
28
|
+
mail(to: @request.mail, subject: I18n.t('mailers.registration_requests.rejected.subject'))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
class RegistrationRequest < ApplicationRecord
|
3
|
+
validates :mail, :firstname, :lastname, :organization, presence: true
|
4
|
+
validate :check_user_already_exists!
|
5
|
+
|
6
|
+
attr_accessor :roles
|
7
|
+
|
8
|
+
def fullname
|
9
|
+
"#{firstname} #{lastname}"
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def check_user_already_exists!
|
15
|
+
return unless User.find_by(mail: mail)
|
16
|
+
|
17
|
+
errors.add(:mail, :taken)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -3,7 +3,13 @@ require 'request_store_rails'
|
|
3
3
|
|
4
4
|
module EgovUtils
|
5
5
|
class User < Principal
|
6
|
+
acts_as_paranoid without_default_scope: true
|
7
|
+
|
6
8
|
DEFAULT_ROLE = nil
|
9
|
+
SEARCH_FIELDS = [
|
10
|
+
'login', 'firstname', 'lastname', 'mail',
|
11
|
+
"CONCAT(firstname, ' ', lastname)", "CONCAT(lastname, ' ', firstname)"
|
12
|
+
].freeze
|
7
13
|
|
8
14
|
has_and_belongs_to_many :groups
|
9
15
|
|
@@ -36,6 +42,12 @@ module EgovUtils
|
|
36
42
|
not_in_group(group).where(provider: nil)
|
37
43
|
}
|
38
44
|
|
45
|
+
scope :search, lambda { |search_term|
|
46
|
+
search_term = search_term.to_s
|
47
|
+
term = SEARCH_FIELDS.map { |field| "#{field} ILIKE :search" }.join(' OR ')
|
48
|
+
where(term, search: "%#{sanitize_sql_like(search_term)}%")
|
49
|
+
}
|
50
|
+
|
39
51
|
attribute :generate_password, :boolean, default: false
|
40
52
|
|
41
53
|
def self.authenticate(login, password, active_only=true)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
class RefreshGroups
|
3
|
+
|
4
|
+
def call
|
5
|
+
hsh = groups.each_with_object({}) do |group, memo|
|
6
|
+
infos = group.ldap_members
|
7
|
+
infos.each do |info|
|
8
|
+
memo[info] ||= []
|
9
|
+
memo[info] << group
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
hsh.each do |info, groups|
|
14
|
+
user = EgovUtils::User.find_by(login: info[:login])
|
15
|
+
next unless user
|
16
|
+
|
17
|
+
all_groups = user.groups.where(ldap_uid: nil) + groups
|
18
|
+
user.update(info.merge(groups: all_groups))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def groups
|
25
|
+
EgovUtils::Group.where.not(ldap_uid: nil)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -6,7 +6,7 @@ module EgovUtils
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def call
|
9
|
-
group_ids = (
|
9
|
+
group_ids = (current_non_ldap_groups + ldap_groups).compact.map(&:id)
|
10
10
|
user.group_ids = group_ids
|
11
11
|
user
|
12
12
|
end
|
@@ -18,14 +18,13 @@ module EgovUtils
|
|
18
18
|
def ldap_groups
|
19
19
|
return [] if user.provider.blank?
|
20
20
|
|
21
|
-
@ldap_groups ||=
|
21
|
+
@ldap_groups ||=
|
22
22
|
EgovUtils::Group.where(provider: user.provider).to_a.select do |g|
|
23
23
|
user.auth_source.member?(user.ldap_dn, g.external_uid)
|
24
24
|
end
|
25
|
-
end
|
26
25
|
end
|
27
26
|
|
28
|
-
def
|
27
|
+
def current_non_ldap_groups
|
29
28
|
@current_non_ldap_groups ||= user.groups.where(ldap_uid: nil)
|
30
29
|
end
|
31
30
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
module RegistrationRequests
|
3
|
+
class CheckAutoAccept < ActiveInteraction::Base
|
4
|
+
record :registration_request, class: 'EgovUtils::RegistrationRequest'
|
5
|
+
|
6
|
+
def execute
|
7
|
+
member = nil
|
8
|
+
EgovUtils::Group.where.not(provider: nil).detect do |g|
|
9
|
+
member = g.ldap_members.detect do |m|
|
10
|
+
m[:login] == registration_request.mail
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
return unless member
|
15
|
+
|
16
|
+
registration_request.update(
|
17
|
+
status: 'accepted',
|
18
|
+
internal_note:
|
19
|
+
'Automaticky schválen na základě členství v LDAP skupině'
|
20
|
+
)
|
21
|
+
|
22
|
+
EgovUtils::RegistrationRequestMailer
|
23
|
+
.auto_accepted(registration_request.id)
|
24
|
+
.deliver_now
|
25
|
+
|
26
|
+
registration_request
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
module RegistrationRequests
|
3
|
+
class Create < ActiveInteraction::Base
|
4
|
+
string :mail
|
5
|
+
string :firstname
|
6
|
+
string :lastname
|
7
|
+
string :organization
|
8
|
+
string :note
|
9
|
+
|
10
|
+
def execute
|
11
|
+
request = RegistrationRequest.create(inputs.merge(status: :pending))
|
12
|
+
|
13
|
+
if request.persisted?
|
14
|
+
EgovUtils::RegistrationRequestMailer.created(request.id).deliver_now
|
15
|
+
CheckAutoAcceptJob.perform_async(request.id)
|
16
|
+
else
|
17
|
+
errors.merge!(request.errors)
|
18
|
+
end
|
19
|
+
|
20
|
+
request
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
module RegistrationRequests
|
3
|
+
class HandleRequest < ActiveInteraction::Base
|
4
|
+
record :registration_request, class: 'EgovUtils::RegistrationRequest'
|
5
|
+
string :status
|
6
|
+
string :reason, default: nil
|
7
|
+
string :internal_reason, default: nil
|
8
|
+
array :roles, default: [] do
|
9
|
+
string
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute
|
13
|
+
registration_request.update(
|
14
|
+
status: status,
|
15
|
+
reason: reason,
|
16
|
+
internal_reason: internal_reason
|
17
|
+
)
|
18
|
+
|
19
|
+
case status
|
20
|
+
when 'accepted'
|
21
|
+
user = create_user!
|
22
|
+
EgovUtils::RegistrationRequestMailer
|
23
|
+
.accepted(registration_request.id, user.id, password)
|
24
|
+
.deliver_now
|
25
|
+
when 'rejected'
|
26
|
+
EgovUtils::RegistrationRequestMailer
|
27
|
+
.rejected(registration_request.id)
|
28
|
+
.deliver_now
|
29
|
+
end
|
30
|
+
|
31
|
+
registration_request
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def create_user!
|
37
|
+
user = User.create(
|
38
|
+
mail: registration_request.mail,
|
39
|
+
login: registration_request.mail,
|
40
|
+
firstname: registration_request.firstname,
|
41
|
+
lastname: registration_request.lastname,
|
42
|
+
password: password,
|
43
|
+
password_confirmation: password,
|
44
|
+
roles: roles.compact_blank,
|
45
|
+
must_change_password: true,
|
46
|
+
active: true,
|
47
|
+
last_login_at: Time.current
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
def password
|
52
|
+
@password ||= SecureRandom.hex(8)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
%h1= t('.title')
|
2
|
+
= bootstrap_form_for(current_user, url: current_user_path) do |form|
|
3
|
+
= form.text_field :login
|
4
|
+
= form.text_field :firstname
|
5
|
+
= form.text_field :lastname
|
6
|
+
.passwords
|
7
|
+
%h2= t('.password_change')
|
8
|
+
%em= t('.password_change_note')
|
9
|
+
= form.password_field :password
|
10
|
+
= form.password_field :password_confirmation
|
11
|
+
= form.submit
|
12
|
+
|
@@ -1,21 +1,30 @@
|
|
1
|
-
%
|
2
|
-
%li.nav-item
|
3
|
-
= link_to(EgovUtils::User.model_name.human(count: :other), users_path, id: 'users_tab', class: 'nav-link', 'data-toggle'=>'tab', 'aria-controls'=>'users_container')
|
4
|
-
%li.nav-item
|
5
|
-
= link_to(EgovUtils::Group.model_name.human(count: :other), groups_path, id: 'groups_tab', class: 'nav-link active', 'data-toggle'=>'tab', 'aria-controls'=>'groups_container')
|
1
|
+
%h1= EgovUtils::Group.model_name.human(count: 2)
|
6
2
|
|
7
|
-
.
|
8
|
-
#users_container.tab-pane.fade{role: 'tabpanel', 'aria-labelledby'=>'users_tab'}
|
9
|
-
= render 'egov_utils/users/users_tab', users: @users
|
10
|
-
#groups_container.tab-pane.fade.show.active{role: 'tabpanel', 'aria-labelledby'=>'groups_tab'}
|
11
|
-
= render 'egov_utils/groups/groups_tab', groups: @groups
|
12
|
-
#create_container.tab-pane.fade{role: 'tabpanel', 'aria-labelledby'=>'create_tab'}
|
13
|
-
%h3= t('label_ldap')
|
14
|
-
= render 'egov_utils/users/ldap_search'
|
15
|
-
%h3= t('label_new')
|
16
|
-
= bootstrap_form_for(EgovUtils::User.new) do |f|
|
17
|
-
= render 'egov_utils/users/form', form: f
|
3
|
+
= link_to t('helpers.action.egov_utils.group.new'), egov_utils.new_group_path, class: 'btn btn-primary'
|
18
4
|
|
19
|
-
|
20
|
-
|
21
|
-
|
5
|
+
%table.table.table-striped
|
6
|
+
%thead
|
7
|
+
%tr
|
8
|
+
%th= EgovUtils::Group.human_attribute_name('name')
|
9
|
+
%th= EgovUtils::Group.human_attribute_name('provider')
|
10
|
+
%th= EgovUtils::Group.human_attribute_name('roles')
|
11
|
+
%th= t('label_actions')
|
12
|
+
%tbody
|
13
|
+
- if @groups.empty?
|
14
|
+
%tr
|
15
|
+
%td{colspan: 4}= t('label_no_entries')
|
16
|
+
- @groups.each do |group|
|
17
|
+
%tr
|
18
|
+
%td= link_to(group.name, group)
|
19
|
+
%td= group.provider
|
20
|
+
%td= group.roles.map { I18n.t("roles.#{_1}") }.join(', ')
|
21
|
+
%td
|
22
|
+
- if can?(:manage, group)
|
23
|
+
= link_to(t('label_edit'), edit_group_path(group), class: 'btn btn-secondary btn-sm')
|
24
|
+
|
25
|
+
.row
|
26
|
+
.col-md-4
|
27
|
+
= page_entries_info @groups
|
28
|
+
.col-md-4
|
29
|
+
= paginate @groups
|
30
|
+
.col-md-4
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<p>
|
2
|
+
v aplikaci <%= t(:app_name) %> Vám byl vytvořen přístup.
|
3
|
+
Vaše přístupové údaje jsou:
|
4
|
+
</p>
|
5
|
+
<ul>
|
6
|
+
<li>login: <%= @user.login %></li>
|
7
|
+
<li>heslo: <%= @password %></li>
|
8
|
+
</ul>
|
9
|
+
|
10
|
+
<p>
|
11
|
+
Po prvním přihlášení budete vyzváni ke změně hesla.
|
12
|
+
</p>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<p>
|
2
|
+
Vaše žádost o registraci do aplikace <%= t(:app_name) %> byla přijata.
|
3
|
+
</p>
|
4
|
+
|
5
|
+
<ul>
|
6
|
+
<li>E-mail: <%= @request.mail %></li>
|
7
|
+
<li>Jméno: <%= @request.firstname %></li>
|
8
|
+
<li>Příjmení: <%= @request.lastname %></li>
|
9
|
+
<li>Organizace: <%= @request.organization %></li>
|
10
|
+
<li>Poznámka: <%= @request.note %></li>
|
11
|
+
</ul>
|
12
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
%h1= t('.title')
|
2
|
+
|
3
|
+
%table.table.table-striped
|
4
|
+
%thead
|
5
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('fullname')
|
6
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('created_at')
|
7
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('status')
|
8
|
+
%th= t('label_actions')
|
9
|
+
%tbody
|
10
|
+
- if @registration_requests.empty?
|
11
|
+
%tr
|
12
|
+
%td{colspan: 4}= t('label_no_entries')
|
13
|
+
- @registration_requests.each do |request|
|
14
|
+
%tr
|
15
|
+
%td
|
16
|
+
%div= request.fullname
|
17
|
+
%small= request.mail
|
18
|
+
%td= l(request.created_at)
|
19
|
+
%td= t("registration_request.statuses.#{request.status}")
|
20
|
+
%td
|
21
|
+
= link_to t('.show'), egov_utils.registration_request_path(request), class: 'btn btn-secondary btn-sm'
|
22
|
+
|
23
|
+
.row
|
24
|
+
.col-md-4
|
25
|
+
= page_entries_info @registration_requests
|
26
|
+
.col-md-4
|
27
|
+
= paginate @registration_requests
|
28
|
+
.col-md-4
|
29
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
%h1= t('.title', name: @registration_request.fullname)
|
2
|
+
|
3
|
+
%table.table.table-striped
|
4
|
+
%tbody
|
5
|
+
%tr
|
6
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('mail')
|
7
|
+
%td= @registration_request.mail
|
8
|
+
%tr
|
9
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('firstname')
|
10
|
+
%td= @registration_request.firstname
|
11
|
+
%tr
|
12
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('lastname')
|
13
|
+
%td= @registration_request.lastname
|
14
|
+
%tr
|
15
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('organization')
|
16
|
+
%td= @registration_request.organization
|
17
|
+
%tr
|
18
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('note')
|
19
|
+
%td= @registration_request.note
|
20
|
+
%tr
|
21
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('created_at')
|
22
|
+
%td= l(@registration_request.created_at)
|
23
|
+
%tr
|
24
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('status')
|
25
|
+
%td= t("registration_request.statuses.#{@registration_request.status}")
|
26
|
+
- if @registration_request.status != 'pending'
|
27
|
+
%tr
|
28
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('reason')
|
29
|
+
%td= @registration_request.reason
|
30
|
+
%tr
|
31
|
+
%th= EgovUtils::RegistrationRequest.human_attribute_name('internal_reason')
|
32
|
+
%td= @registration_request.internal_reason
|
33
|
+
|
34
|
+
- if @registration_request.status == 'pending'
|
35
|
+
= bootstrap_form_for(@registration_request, url: '#') do |f|
|
36
|
+
= f.text_area(:reason)
|
37
|
+
= f.text_area(:internal_reason)
|
38
|
+
= f.hidden_field(:status, value: nil)
|
39
|
+
= f.collection_check_boxes :roles, EgovUtils::UserUtils::Role.roles, :first, ->(role) { I18n.t("roles.#{role.first}") }
|
40
|
+
|
41
|
+
= f.submit t('.accept'), class: 'btn btn-success', data: { value: 'accepted' }
|
42
|
+
= f.submit t('.reject'), class: 'btn btn-danger', data: { value: 'rejected' }
|
43
|
+
|
44
|
+
:javascript
|
45
|
+
$(function() {
|
46
|
+
$('input[type=submit]').click(function(e) {
|
47
|
+
var status = $(this).data('value');
|
48
|
+
$('#registration_request_status').val(status);
|
49
|
+
});
|
50
|
+
});
|
51
|
+
|
@@ -6,3 +6,6 @@
|
|
6
6
|
= link_to t('label_signup'), egov_utils.new_user_path, class: 'btn btn-secondary'
|
7
7
|
- if EgovUtils::Settings.allow_password_reset?
|
8
8
|
= link_to t('label_forgotten_password'), egov_utils.reset_passwords_path
|
9
|
+
|
10
|
+
%br
|
11
|
+
= link_to t('.registration_request'), new_registration_request_path
|
@@ -1,4 +1,13 @@
|
|
1
|
+
%h1= t('.title')
|
2
|
+
|
1
3
|
= bootstrap_form_for(@user) do |f|
|
2
4
|
= f.text_field :days_before_inactive
|
5
|
+
= f.text_field :days_before_archive
|
6
|
+
= f.collection_check_boxes :roles, EgovUtils::UserUtils::Role.roles, :first, ->(role) { I18n.t("roles.#{role.first}") }
|
7
|
+
- if @user.password_change_possible?
|
8
|
+
%h2= t('.password_change')
|
9
|
+
%em= t('.password_change_note')
|
10
|
+
= f.password_field :password
|
11
|
+
= f.password_field :password_confirmation
|
3
12
|
.form-actions
|
4
13
|
= f.submit
|
@@ -1,26 +1,43 @@
|
|
1
|
-
%
|
2
|
-
%li.nav-item
|
3
|
-
= link_to(EgovUtils::User.model_name.human(count: :other), '#users_container', id: 'users_tab', class: 'nav-link active', 'data-toggle'=>'tab', 'aria-controls'=>'users_container')
|
4
|
-
%li.nav-item
|
5
|
-
= link_to(EgovUtils::Group.model_name.human(count: :other), '#groups_container', id: 'groups_tab', class: 'nav-link', 'data-toggle'=>'tab', 'aria-controls'=>'groups_container')
|
6
|
-
%li.nav-item.dropdown
|
7
|
-
%a.nav-link.dropdown-toggle{'data-toggle'=>'dropdown', 'href'=>'#', 'role'=>'button'}
|
8
|
-
= t('label_new')
|
9
|
-
.dropdown-menu
|
10
|
-
= link_to(t('label_new'), '#create', id: 'create_tab', class: 'dropdown-item', 'data-toggle'=>'tab', 'aria-controls'=>'create')
|
11
|
-
= link_to(t('label_ldap'), '#create_ldap', id: 'create_tab', class: 'dropdown-item', 'data-toggle'=>'tab', 'aria-controls'=>'create_ldap')
|
1
|
+
%h1= EgovUtils::User.model_name.human(count: 2)
|
12
2
|
|
13
|
-
.
|
14
|
-
|
15
|
-
=
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
=
|
21
|
-
|
22
|
-
%
|
23
|
-
=
|
24
|
-
|
25
|
-
|
26
|
-
|
3
|
+
= bootstrap_form_tag(url: egov_utils.users_path, method: :get, layout: :inline) do |f|
|
4
|
+
.form-group
|
5
|
+
= f.text_field :search, value: params[:search], label: false, placeholder: t('label_search'), skip_label: true
|
6
|
+
= f.submit 'Vyhledat', class: 'btn btn-primary btn-sm'
|
7
|
+
|
8
|
+
%table.table.table-striped
|
9
|
+
%thead
|
10
|
+
%th= EgovUtils::User.human_attribute_name('fullname')
|
11
|
+
%th= EgovUtils::User.human_attribute_name('provider')
|
12
|
+
%th= EgovUtils::User.human_attribute_name('roles')
|
13
|
+
%th= EgovUtils::User.human_attribute_name('groups')
|
14
|
+
%th= t('label_actions')
|
15
|
+
%tbody
|
16
|
+
- if @entities.empty?
|
17
|
+
%tr
|
18
|
+
%td{colspan: 4}= t('label_no_entries')
|
19
|
+
- @entities.each do |user|
|
20
|
+
%tr
|
21
|
+
%td
|
22
|
+
%div= user.fullname
|
23
|
+
%small= user.login
|
24
|
+
%td= 'LDAP' if user.provider
|
25
|
+
%td= user.all_role_names.map { I18n.t("roles.#{_1}") }.join(', ')
|
26
|
+
%td= user.groups.map(&:name).join(', ')
|
27
|
+
%td
|
28
|
+
- unless user.active?
|
29
|
+
= button_to(t('label_approve'), approve_user_path(user), class: 'btn btn-primary btn-sm')
|
30
|
+
- if can?(:edit, user)
|
31
|
+
= link_to(t('label_edit'), edit_user_path(user), class: 'btn btn-secondary btn-sm')
|
32
|
+
- if can?(:delete, user)
|
33
|
+
- if user.deleted?
|
34
|
+
= button_to(t('label_unarchive'), unarchive_user_path(user), method: :patch, class: 'btn btn-danger btn-sm')
|
35
|
+
- else
|
36
|
+
= button_to(t('label_archive'), user_path(user), method: :delete, class: 'btn btn-danger btn-sm')
|
37
|
+
|
38
|
+
.row
|
39
|
+
.col-md-4
|
40
|
+
= page_entries_info @entities
|
41
|
+
.col-md-4
|
42
|
+
= paginate @entities
|
43
|
+
.col-md-4
|
data/config/locales/cs.yml
CHANGED
@@ -42,6 +42,7 @@ cs:
|
|
42
42
|
notice_signeup_with_mail: Registrace proběhla úspěšně, byl Vám odeslán potvrzovací e-mail, prosím zkontrolujte svou poštu.
|
43
43
|
notice_password_changed: Heslo bylo úspěšně změněno
|
44
44
|
notice_reset_email_sent: E-mail s instrukcemi pro změnu hesla byl odeslán na zadanou e-mailovou adresu.
|
45
|
+
notice_pw_reset_not_possible: Není možné resetovat heslo, protože váš účet je spravován mimo databázi aplikace VTS. Vaše přihlašovací heslo je stejné jako do ostatních systémů MSp. V případě nutnosti se, prosím, obraťte na technickou podporu Vaší organizace.
|
45
46
|
success_user_confirm: Váše e-mailová adresa byla potvrzena. Nyní se již můžete přihlásit.
|
46
47
|
error_password_expired: Platnost vašeho hesla vypršela. Prosím změňte ho.
|
47
48
|
warning_password_not_changed: Heslo nebylo změněno, zadali jste všechna hesla správně?
|
@@ -68,6 +69,9 @@ cs:
|
|
68
69
|
label_add_group_member: Přidat uživatele
|
69
70
|
label_forgotten_password: Zapomněli jste heslo?
|
70
71
|
label_reset_password: Obnova hesla
|
72
|
+
label_archive: Archivovat
|
73
|
+
label_unarchive: Obnovit
|
74
|
+
label_registration_request: Zažádat o přístup
|
71
75
|
|
72
76
|
text_born_on_at: "Narozen %{date} v %{place}"
|
73
77
|
|
@@ -80,17 +84,22 @@ cs:
|
|
80
84
|
models: &my_models
|
81
85
|
egov_utils/user:
|
82
86
|
one: Uživatel
|
83
|
-
|
87
|
+
few: Uživatelé
|
88
|
+
other: Uživatelů
|
84
89
|
egov_utils/group:
|
85
90
|
one: Skupina
|
86
|
-
|
91
|
+
few: Skupiny
|
92
|
+
other: Skupin
|
87
93
|
egov_utils/address:
|
88
94
|
one: Adresa
|
89
|
-
|
95
|
+
few: Adresy
|
96
|
+
other: Adres
|
90
97
|
|
91
98
|
model_attributes: &my_attributes
|
92
99
|
egov_utils/user:
|
93
100
|
days_before_inactive: Počet dní od posledního přihlášení před deaktivací
|
101
|
+
days_before_archive: Počet dní od deaktivace před automatickou archivací
|
102
|
+
groups: Skupiny
|
94
103
|
login: Přihlašovací email
|
95
104
|
mail: E-mail
|
96
105
|
password_confirmation: Potvrzení hesla
|
@@ -98,8 +107,10 @@ cs:
|
|
98
107
|
lastname: Příjmení
|
99
108
|
fullname: Jméno a příjmení
|
100
109
|
roles: Role
|
110
|
+
provider: Typ
|
101
111
|
generate_password: Generovat heslo
|
102
112
|
egov_utils/group:
|
113
|
+
name: 'Název'
|
103
114
|
roles: Role
|
104
115
|
egov_utils/address:
|
105
116
|
full_address: Adresa
|
@@ -131,6 +142,17 @@ cs:
|
|
131
142
|
name: Název
|
132
143
|
ico: IČO
|
133
144
|
legal_form: Právní forma
|
145
|
+
egov_utils/registration_request:
|
146
|
+
mail: E-mail
|
147
|
+
firstname: Jméno
|
148
|
+
lastname: Příjmení
|
149
|
+
organization: Organizace
|
150
|
+
note: Poznámka
|
151
|
+
created_at: Vytvořeno
|
152
|
+
status: Status
|
153
|
+
fullname: Jméno
|
154
|
+
reason: Odůvodnění
|
155
|
+
internal_reason: Interní poznámka
|
134
156
|
|
135
157
|
models_errors: &my_model_errors
|
136
158
|
profile:
|
@@ -139,6 +161,7 @@ cs:
|
|
139
161
|
model_help_messages: &my_help_messages
|
140
162
|
egov_utils/user:
|
141
163
|
days_before_inactive: Pokud ponecháte pole prázdné, uživatelský účet nebude expirovat.
|
164
|
+
days_before_archive: Pokud ponecháte pole prázdné, uživatelský účet nebude expirovat.
|
142
165
|
generate_password: Heslo bude vygenerováno a posláno uživateli na e-mail, při prvním přihlášení bude heslo muset změnit.
|
143
166
|
|
144
167
|
|
@@ -156,6 +179,8 @@ cs:
|
|
156
179
|
mail: E-mailová adresa
|
157
180
|
|
158
181
|
submits: &my_submits
|
182
|
+
group:
|
183
|
+
update: 'Aktualizovat skupinu'
|
159
184
|
user:
|
160
185
|
update: Aktualizovat uživatele
|
161
186
|
password_change:
|
@@ -181,8 +206,13 @@ cs:
|
|
181
206
|
created: "%{model} úspěšně vytvořen"
|
182
207
|
updated: "%{model} úspěšně aktualizován"
|
183
208
|
destroyed: "%{model} úspěšně smazán"
|
209
|
+
unarchived: "%{model} úspěšně obnoven"
|
184
210
|
|
185
211
|
helpers:
|
212
|
+
action:
|
213
|
+
egov_utils:
|
214
|
+
group:
|
215
|
+
new: 'Nová skupina'
|
186
216
|
label:
|
187
217
|
<<: *my_labels
|
188
218
|
submit:
|
@@ -196,3 +226,51 @@ cs:
|
|
196
226
|
in_past: Musí být v minulosti
|
197
227
|
after_1920: Musí být po roce 1920
|
198
228
|
fileuid_format: Nesprávný tvar spisové značky
|
229
|
+
|
230
|
+
egov_utils:
|
231
|
+
current_users:
|
232
|
+
edit:
|
233
|
+
title: Úprava profilu
|
234
|
+
password_change: Změna hesla
|
235
|
+
password_change_note: Pokud necháte pole prázdná, heslo nebude aktualizováno.
|
236
|
+
groups:
|
237
|
+
edit:
|
238
|
+
title: 'Úprava skupiny'
|
239
|
+
registration_requests:
|
240
|
+
new:
|
241
|
+
title: 'Žádost o registraci'
|
242
|
+
index:
|
243
|
+
show: 'Detail žádosti'
|
244
|
+
title: 'Žádosti o přístup do aplikace'
|
245
|
+
show:
|
246
|
+
title: 'Žádost o registraci - %{name}'
|
247
|
+
accept: 'Přijmout žádost'
|
248
|
+
reject: 'Odmítnout žádost'
|
249
|
+
sessions:
|
250
|
+
new:
|
251
|
+
registration_request: 'Žádost o registraci'
|
252
|
+
users:
|
253
|
+
edit:
|
254
|
+
title: Úprava uživatele
|
255
|
+
password_change: Změna hesla
|
256
|
+
password_change_note: Pokud necháte pole prázdná, heslo nebude aktualizováno.
|
257
|
+
registration_request:
|
258
|
+
statuses:
|
259
|
+
pending: K vyřízení
|
260
|
+
accepted: Schválen
|
261
|
+
rejected: Zamítnut
|
262
|
+
create:
|
263
|
+
success: 'Žádost o registraci úspěšně vytvořena. Váš požadavek bude vyřízen v nejbližších dnech.'
|
264
|
+
update:
|
265
|
+
success: 'Žádost úspěšně uložena'
|
266
|
+
|
267
|
+
mailers:
|
268
|
+
registration_requests:
|
269
|
+
created:
|
270
|
+
subject: 'Žádost o vytvoření účtu v aplikaci VTS přijata'
|
271
|
+
accepted:
|
272
|
+
subject: 'Žádost o vytvoření účtu v aplikaci VTS schválena'
|
273
|
+
auto_accepted:
|
274
|
+
subject: 'Žádost o vytvoření účtu v aplikaci VTS přijata'
|
275
|
+
rejected:
|
276
|
+
subject: 'Žádost o vytvoření účtu v aplikaci VTS odmítnuta'
|
data/config/routes.rb
CHANGED
@@ -10,7 +10,10 @@ EgovUtils::Engine.routes.draw do
|
|
10
10
|
get :search, on: :collection
|
11
11
|
post :approve, on: :member
|
12
12
|
get :confirm, on: :member
|
13
|
+
patch :unarchive, on: :member
|
13
14
|
end
|
15
|
+
resource :current_user, only: %i[edit update]
|
16
|
+
resources :registration_requests, only: %i[new create show index update]
|
14
17
|
|
15
18
|
resources :people do
|
16
19
|
get :addresses
|
@@ -24,7 +27,7 @@ EgovUtils::Engine.routes.draw do
|
|
24
27
|
end
|
25
28
|
resources :roles
|
26
29
|
|
27
|
-
resources :passwords, only: [
|
30
|
+
resources :passwords, only: %i[index edit update] do
|
28
31
|
collection do
|
29
32
|
get 'reset'
|
30
33
|
post 'send_reset_token'
|
@@ -38,6 +41,8 @@ EgovUtils::Engine.routes.draw do
|
|
38
41
|
get '/address/validate_ruian' => 'addresses#validate_ruian', as: :validate_ruian
|
39
42
|
get '/organizations/district_courts' => 'organizations#district_courts', as: :district_courts_organizations
|
40
43
|
|
44
|
+
resource :settings, only: %i[show update]
|
45
|
+
|
41
46
|
namespace :redmine do
|
42
47
|
resources :issues, only: :index
|
43
48
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateEgovUtilsRegistrationRequests < ActiveRecord::Migration[6.1]
|
2
|
+
def change
|
3
|
+
create_table :egov_utils_registration_requests do |t|
|
4
|
+
t.string :mail
|
5
|
+
t.string :firstname
|
6
|
+
t.string :lastname
|
7
|
+
t.string :organization
|
8
|
+
t.string :note
|
9
|
+
t.string :status
|
10
|
+
t.string :reason
|
11
|
+
t.string :internal_reason
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/egov_utils/version.rb
CHANGED
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.
|
4
|
+
version: 1.2.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:
|
11
|
+
date: 2023-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '5.1'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: active_interaction
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: haml
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -510,11 +524,13 @@ files:
|
|
510
524
|
- app/attributes/egov_utils/region.rb
|
511
525
|
- app/controllers/egov_utils/addresses_controller.rb
|
512
526
|
- app/controllers/egov_utils/application_controller.rb
|
527
|
+
- app/controllers/egov_utils/current_users_controller.rb
|
513
528
|
- app/controllers/egov_utils/groups_controller.rb
|
514
529
|
- app/controllers/egov_utils/organizations_controller.rb
|
515
530
|
- app/controllers/egov_utils/passwords_controller.rb
|
516
531
|
- app/controllers/egov_utils/people_controller.rb
|
517
532
|
- app/controllers/egov_utils/redmine/issues_controller.rb
|
533
|
+
- app/controllers/egov_utils/registration_requests_controller.rb
|
518
534
|
- app/controllers/egov_utils/roles_controller.rb
|
519
535
|
- app/controllers/egov_utils/sessions_controller.rb
|
520
536
|
- app/controllers/egov_utils/users_controller.rb
|
@@ -525,7 +541,9 @@ files:
|
|
525
541
|
- app/helpers/egov_utils/roles_helper.rb
|
526
542
|
- app/helpers/egov_utils/users_helper.rb
|
527
543
|
- app/jobs/egov_utils/application_job.rb
|
544
|
+
- app/jobs/egov_utils/registration_requests/check_auto_accept_job.rb
|
528
545
|
- app/mailers/egov_utils/application_mailer.rb
|
546
|
+
- app/mailers/egov_utils/registration_request_mailer.rb
|
529
547
|
- app/mailers/egov_utils/user_mailer.rb
|
530
548
|
- app/models/ability.rb
|
531
549
|
- app/models/egov_utils/abstract_person.rb
|
@@ -538,6 +556,7 @@ files:
|
|
538
556
|
- app/models/egov_utils/natural_person.rb
|
539
557
|
- app/models/egov_utils/person.rb
|
540
558
|
- app/models/egov_utils/principal.rb
|
559
|
+
- app/models/egov_utils/registration_request.rb
|
541
560
|
- app/models/egov_utils/user.rb
|
542
561
|
- app/resources/egov_utils/legal_form.rb
|
543
562
|
- app/resources/egov_utils/love.rb
|
@@ -549,7 +568,12 @@ files:
|
|
549
568
|
- app/schemas/egov_utils/natural_person_schema.rb
|
550
569
|
- app/schemas/egov_utils/person_schema.rb
|
551
570
|
- app/schemas/egov_utils/user_schema.rb
|
571
|
+
- app/services/egov_utils/archive_users.rb
|
572
|
+
- app/services/egov_utils/refresh_groups.rb
|
552
573
|
- app/services/egov_utils/refresh_user_groups.rb
|
574
|
+
- app/services/egov_utils/registration_requests/check_auto_accept.rb
|
575
|
+
- app/services/egov_utils/registration_requests/create.rb
|
576
|
+
- app/services/egov_utils/registration_requests/handle_request.rb
|
553
577
|
- app/validators/birthday_validator.rb
|
554
578
|
- app/validators/email_validator.rb
|
555
579
|
- app/validators/fileuid_validator.rb
|
@@ -559,9 +583,12 @@ files:
|
|
559
583
|
- app/views/common/_modal.html.haml
|
560
584
|
- app/views/common/modal_action.js.erb
|
561
585
|
- app/views/egov_utils/addresses/_form.html.haml
|
586
|
+
- app/views/egov_utils/current_users/edit.html.haml
|
562
587
|
- app/views/egov_utils/groups/_form.html.haml
|
563
588
|
- app/views/egov_utils/groups/_groups_tab.html.haml
|
589
|
+
- app/views/egov_utils/groups/edit.html.haml
|
564
590
|
- app/views/egov_utils/groups/index.html.haml
|
591
|
+
- app/views/egov_utils/groups/new.html.haml
|
565
592
|
- app/views/egov_utils/groups/new_users.html.haml
|
566
593
|
- app/views/egov_utils/groups/show.html.haml
|
567
594
|
- app/views/egov_utils/passwords/edit.html.haml
|
@@ -569,6 +596,13 @@ files:
|
|
569
596
|
- app/views/egov_utils/passwords/reset.html.haml
|
570
597
|
- app/views/egov_utils/people/_form.html.haml
|
571
598
|
- app/views/egov_utils/redmine/issues/index.html.haml
|
599
|
+
- app/views/egov_utils/registration_request_mailer/accepted.html.erb
|
600
|
+
- app/views/egov_utils/registration_request_mailer/auto_accepted.html.erb
|
601
|
+
- app/views/egov_utils/registration_request_mailer/created.html.erb
|
602
|
+
- app/views/egov_utils/registration_request_mailer/rejected.html.erb
|
603
|
+
- app/views/egov_utils/registration_requests/index.html.haml
|
604
|
+
- app/views/egov_utils/registration_requests/new.html.haml
|
605
|
+
- app/views/egov_utils/registration_requests/show.html.haml
|
572
606
|
- app/views/egov_utils/roles/index.html.haml
|
573
607
|
- app/views/egov_utils/sessions/new.html.haml
|
574
608
|
- app/views/egov_utils/user_mailer/account_information.html.erb
|
@@ -617,6 +651,9 @@ files:
|
|
617
651
|
- db/migrate/20180424143207_add_titles_to_natural_people.rb
|
618
652
|
- db/migrate/20220331113917_add_days_before_inactive_to_egov_utils_users.rb
|
619
653
|
- db/migrate/20220624070709_migrate_person_residence_to_addresses.rb
|
654
|
+
- db/migrate/20230407114921_add_deleted_at_to_egov_utils_users.rb
|
655
|
+
- db/migrate/20230408123813_create_egov_utils_registration_requests.rb
|
656
|
+
- db/migrate/20230412063325_add_days_before_archive_to_egov_utils_users.rb
|
620
657
|
- lib/azahara_schema_currency.rb
|
621
658
|
- lib/azahara_schema_currency/aggregation_attribute_patch.rb
|
622
659
|
- lib/azahara_schema_currency/association_attribute_patch.rb
|