egov_utils 0.6.5 → 0.7.2
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/users_controller.rb +15 -2
- data/app/models/egov_utils/user.rb +10 -1
- data/app/views/egov_utils/users/_users_tab.html.haml +2 -0
- data/app/views/egov_utils/users/edit.html.haml +4 -0
- data/config/locales/cs.yml +4 -0
- data/db/migrate/20220331113917_add_days_before_inactive_to_egov_utils_users.rb +5 -0
- data/lib/egov_utils/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45926975307ac0185bf837788bb5d0391b031e5c1772ae4b2e01cfd17d8a59c0
|
4
|
+
data.tar.gz: 7c2af128ab6e9d2e5ec00b7b7ec2b69fd95d5fa268cbe25beb53fb94abee093d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676aebd939af9730219ec9e5e2b45fe1acc47b63a1d308d58dca94aab8e31fc2051e37ce1e53e3842a2ada7a1c1c37162510a135b2c79dd0535f6dbb6f2fad1f
|
7
|
+
data.tar.gz: ae63960e5446f72c787d11c02bd738468b38dbbb94a464a2e7d6ed47d3ba59c3c49f97932280e45dc79d94ca8ee9d4bdb14439fcd3b01645cbfad599c0effc96
|
@@ -4,9 +4,9 @@ require_dependency "egov_utils/auth_source"
|
|
4
4
|
module EgovUtils
|
5
5
|
class UsersController < ApplicationController
|
6
6
|
|
7
|
-
skip_before_action :require_login, only: [:new, :create, :confirm]
|
7
|
+
skip_before_action :require_login, only: [:new, :create, :confirm, :edit, :update]
|
8
8
|
|
9
|
-
load_and_authorize_resource only: [:index, :new, :create, :show, :destroy]
|
9
|
+
load_and_authorize_resource only: [:index, :new, :create, :show, :destroy, :edit, :update]
|
10
10
|
|
11
11
|
def index
|
12
12
|
providers
|
@@ -46,6 +46,15 @@ module EgovUtils
|
|
46
46
|
def show
|
47
47
|
end
|
48
48
|
|
49
|
+
def edit
|
50
|
+
end
|
51
|
+
|
52
|
+
def update
|
53
|
+
@user.update(update_params)
|
54
|
+
|
55
|
+
redirect_to users_path, notice: t('activerecord.successful.messages.updated', model: User.model_name.human)
|
56
|
+
end
|
57
|
+
|
49
58
|
def destroy
|
50
59
|
@user.destroy
|
51
60
|
redirect_to users_path, notice: t('activerecord.successful.messages.destroyed', model: User.model_name.human)
|
@@ -92,5 +101,9 @@ module EgovUtils
|
|
92
101
|
params_to_permit << :generate_password if current_user.logged?
|
93
102
|
params.require(:user).permit(*params_to_permit)
|
94
103
|
end
|
104
|
+
|
105
|
+
def update_params
|
106
|
+
params.require(:user).permit(:days_before_inactive)
|
107
|
+
end
|
95
108
|
end
|
96
109
|
end
|
@@ -63,7 +63,16 @@ module EgovUtils
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
|
+
if user && !user.new_record?
|
68
|
+
# Check last login
|
69
|
+
if user.days_before_inactive && (user.last_login_at || user.created_at) < (Time.now - user.days_before_inactive.days)
|
70
|
+
user.update_column(:active, false)
|
71
|
+
end
|
72
|
+
|
73
|
+
user.update_column(:last_login_at, Time.now) if user.active?
|
74
|
+
end
|
75
|
+
|
67
76
|
user
|
68
77
|
end
|
69
78
|
|
@@ -23,6 +23,8 @@
|
|
23
23
|
= button_to(t('label_delete'), user_path(user), method: :delete, class: 'btn btn-warning btn-sm')
|
24
24
|
- if can?(:manage, user) && user.password_change_possible?
|
25
25
|
= link_to(t('label_change_password'), new_password_path(user), class: 'btn btn-secondary btn-sm')
|
26
|
+
- if can?(:edit, user)
|
27
|
+
= link_to(t('label_edit'), edit_user_path(user), class: 'btn btn-secondary btn-sm')
|
26
28
|
- unless user.active?
|
27
29
|
= button_to(t('label_approve'), approve_user_path(user), class: 'btn btn-primary btn-sm')
|
28
30
|
|
data/config/locales/cs.yml
CHANGED
@@ -90,6 +90,7 @@ cs:
|
|
90
90
|
|
91
91
|
model_attributes: &my_attributes
|
92
92
|
egov_utils/user:
|
93
|
+
days_before_inactive: Počet dní od posledního přihlášení před deaktivací
|
93
94
|
login: Přihlašovací email
|
94
95
|
mail: E-mail
|
95
96
|
password_confirmation: Potvrzení hesla
|
@@ -137,6 +138,7 @@ cs:
|
|
137
138
|
|
138
139
|
model_help_messages: &my_help_messages
|
139
140
|
egov_utils/user:
|
141
|
+
days_before_inactive: Pokud ponecháte pole prázdné, uživatelský účet nebude expirovat.
|
140
142
|
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.
|
141
143
|
|
142
144
|
|
@@ -154,6 +156,8 @@ cs:
|
|
154
156
|
mail: E-mailová adresa
|
155
157
|
|
156
158
|
submits: &my_submits
|
159
|
+
user:
|
160
|
+
update: Aktualizovat uživatele
|
157
161
|
password_change:
|
158
162
|
submit: Změnit heslo
|
159
163
|
|
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: 0.
|
4
|
+
version: 0.7.2
|
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: 2022-
|
11
|
+
date: 2022-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -581,6 +581,7 @@ files:
|
|
581
581
|
- app/views/egov_utils/users/_form.html.haml
|
582
582
|
- app/views/egov_utils/users/_ldap_search.html.haml
|
583
583
|
- app/views/egov_utils/users/_users_tab.html.haml
|
584
|
+
- app/views/egov_utils/users/edit.html.haml
|
584
585
|
- app/views/egov_utils/users/index.html.haml
|
585
586
|
- app/views/egov_utils/users/new.html.haml
|
586
587
|
- app/views/egov_utils/users/show.html.haml
|
@@ -613,6 +614,7 @@ files:
|
|
613
614
|
- db/migrate/20180403141531_join_people_tables.rb
|
614
615
|
- db/migrate/20180403150556_create_egov_utils_legal_people.rb
|
615
616
|
- db/migrate/20180424143207_add_titles_to_natural_people.rb
|
617
|
+
- db/migrate/20220331113917_add_days_before_inactive_to_egov_utils_users.rb
|
616
618
|
- lib/azahara_schema_currency.rb
|
617
619
|
- lib/azahara_schema_currency/aggregation_attribute_patch.rb
|
618
620
|
- lib/azahara_schema_currency/association_attribute_patch.rb
|