lesli_shield 1.1.9 → 1.1.10

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/lesli_shield/login-background.webp +0 -0
  3. data/app/assets/images/lesli_shield/register-background.webp +0 -0
  4. data/app/assets/stylesheets/lesli_shield/application.css +23 -28
  5. data/app/assets/stylesheets/lesli_shield/invitations.css +1 -1
  6. data/app/assets/stylesheets/lesli_shield/registrations.css +35 -10
  7. data/app/assets/stylesheets/lesli_shield/sessions.css +1 -1
  8. data/app/controllers/lesli_shield/profile/passwords_controller.rb +0 -2
  9. data/app/controllers/lesli_shield/profiles_controller.rb +0 -1
  10. data/app/controllers/lesli_shield/user/roles_controller.rb +35 -59
  11. data/app/controllers/lesli_shield/users_controller.rb +4 -2
  12. data/app/controllers/users/registrations_controller.rb +27 -0
  13. data/app/controllers/users/sessions_controller.rb +11 -0
  14. data/app/interfaces/lesli_shield/security_interface.rb +146 -0
  15. data/app/models/concerns/lesli_shield/user_authentication.rb +0 -29
  16. data/app/models/concerns/lesli_shield/user_legal_acceptance.rb +45 -0
  17. data/app/models/concerns/lesli_shield/user_security.rb +23 -14
  18. data/app/services/lesli_shield/user_role_service.rb +37 -0
  19. data/app/services/lesli_shield/user_validator_service.rb +6 -28
  20. data/app/views/devise/registrations/_terms.html.erb +34 -0
  21. data/app/views/devise/registrations/new.html.erb +3 -5
  22. data/app/views/devise/sessions/new.html.erb +2 -1
  23. data/app/views/lesli_shield/partials/_navigation.html.erb +5 -5
  24. data/app/views/lesli_shield/roles/show.html.erb +40 -50
  25. data/app/views/lesli_shield/user/roles/index.html.erb +1 -16
  26. data/app/views/lesli_shield/users/_management-privileges.html.erb +74 -68
  27. data/app/views/lesli_shield/users/show.html.erb +1 -1
  28. data/config/locales/translations.en.yml +8 -1
  29. data/config/locales/translations.es.yml +8 -1
  30. data/config/locales/user_roles.en.yml +16 -0
  31. data/config/locales/user_roles.es.yml +16 -0
  32. data/config/routes.rb +1 -1
  33. data/lib/lesli_shield/engine.rb +4 -0
  34. data/lib/lesli_shield/version.rb +1 -1
  35. metadata +10 -6
  36. data/app/assets/images/lesli_shield/login-background.jpg +0 -0
  37. data/app/assets/images/lesli_shield/register-background.jpg +0 -0
  38. data/app/interfaces/lesli_shield/authentication_interface.rb +0 -64
  39. data/app/interfaces/lesli_shield/authorization_interface.rb +0 -46
@@ -58,6 +58,10 @@ module LesliShield
58
58
  Lesli::User.include(LesliShield::UserSecurity)
59
59
  end
60
60
 
61
+ unless Lesli::User < LesliShield::UserLegalAcceptance
62
+ Lesli::User.include(LesliShield::UserLegalAcceptance)
63
+ end
64
+
61
65
  unless Lesli::Role < LesliShield::RoleManagement
62
66
  Lesli::Role.include(LesliShield::RoleManagement)
63
67
  end
@@ -1,4 +1,4 @@
1
1
  module LesliShield
2
- VERSION = "1.1.9"
2
+ VERSION = "1.1.10"
3
3
  BUILD = "1795131757"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_shield
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-19 00:00:00.000000000 Z
11
+ date: 2026-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lesli
@@ -48,8 +48,8 @@ extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
50
  - Rakefile
51
- - app/assets/images/lesli_shield/login-background.jpg
52
- - app/assets/images/lesli_shield/register-background.jpg
51
+ - app/assets/images/lesli_shield/login-background.webp
52
+ - app/assets/images/lesli_shield/register-background.webp
53
53
  - app/assets/images/lesli_shield/shield-logo.svg
54
54
  - app/assets/javascripts/lesli_shield/application.js
55
55
  - app/assets/javascripts/lesli_shield/confirmations.js
@@ -87,8 +87,7 @@ files:
87
87
  - app/helpers/lesli_shield/settings_helper.rb
88
88
  - app/helpers/lesli_shield/user/roles_helper.rb
89
89
  - app/helpers/lesli_shield/users_helper.rb
90
- - app/interfaces/lesli_shield/authentication_interface.rb
91
- - app/interfaces/lesli_shield/authorization_interface.rb
90
+ - app/interfaces/lesli_shield/security_interface.rb
92
91
  - app/jobs/lesli_shield/application_job.rb
93
92
  - app/jobs/lesli_shield/invitation_delivery_job.rb
94
93
  - app/mailers/lesli_shield/application_mailer.rb
@@ -96,6 +95,7 @@ files:
96
95
  - app/mailers/lesli_shield/invitation_mailer.rb
97
96
  - app/models/concerns/lesli_shield/role_management.rb
98
97
  - app/models/concerns/lesli_shield/user_authentication.rb
98
+ - app/models/concerns/lesli_shield/user_legal_acceptance.rb
99
99
  - app/models/concerns/lesli_shield/user_security.rb
100
100
  - app/models/lesli_shield/account.rb
101
101
  - app/models/lesli_shield/application_record.rb
@@ -121,6 +121,7 @@ files:
121
121
  - app/services/lesli_shield/role_service.rb
122
122
  - app/services/lesli_shield/tokens.rb
123
123
  - app/services/lesli_shield/user_registration_service.rb
124
+ - app/services/lesli_shield/user_role_service.rb
124
125
  - app/services/lesli_shield/user_session_service.rb
125
126
  - app/services/lesli_shield/user_validator_service.rb
126
127
  - app/views/devise/confirmations/new.html.erb
@@ -132,6 +133,7 @@ files:
132
133
  - app/views/devise/mailer/unlock_instructions.html.erb
133
134
  - app/views/devise/passwords/edit.html.erb
134
135
  - app/views/devise/passwords/new.html.erb
136
+ - app/views/devise/registrations/_terms.html.erb
135
137
  - app/views/devise/registrations/edit.html.erb
136
138
  - app/views/devise/registrations/new.html.erb
137
139
  - app/views/devise/sessions/new.html.erb
@@ -212,6 +214,8 @@ files:
212
214
  - config/locales/devise.es.yml
213
215
  - config/locales/translations.en.yml
214
216
  - config/locales/translations.es.yml
217
+ - config/locales/user_roles.en.yml
218
+ - config/locales/user_roles.es.yml
215
219
  - config/routes.rb
216
220
  - db/migrate/v1/0801000110_create_lesli_shield_accounts.rb
217
221
  - db/migrate/v1/0801100210_create_lesli_shield_role_actions.rb
@@ -1,64 +0,0 @@
1
- module LesliShield
2
- module AuthenticationInterface
3
-
4
- # Validate user authentication and session status
5
- def authenticate_request
6
-
7
- # this version Lesli requires to be mounted as root "/"
8
- # engine_path = Lesli::Engine.routes.find_script_name({})
9
- engine_path = nil
10
-
11
- # check if the users is logged into the system
12
- unless user_signed_in?()
13
-
14
- message = "Please Login to view that page!"
15
-
16
- # check if requested url is valid
17
- if (request.get? && is_navigational_format? && !request.xhr? && !request.fullpath.blank?)
18
-
19
- # redirect only if the path worth it
20
- if request.fullpath != "/"
21
-
22
- # redirect with requested url, so user will be redirected after login
23
- redirect_to("#{engine_path}/login?r=#{request.fullpath}", notice: message) and return
24
-
25
- end
26
-
27
- end
28
-
29
- # redirect to root route
30
- redirect_to("#{engine_path}/login", notice: message) and return
31
-
32
- end
33
-
34
- # run aditinal validations only for html requests
35
- return true unless request.format.html?
36
-
37
- # # get the current user session
38
- # current_session = current_user.sessions.find_by(id: session[:user_session_id])
39
-
40
- # # check if user has an active session
41
- # if current_session.equal? nil or !current_session.active?
42
- # current_user.log(operation: "system_session_logout", description: "session finished by the system")
43
- # sign_out current_user
44
- # redirect_to "#{engine_path}/logout" and return
45
- # end
46
-
47
- # if !current_session.expiration_at.blank? && current_session.expiration_at < Time.current
48
- # current_user.log(operation: "system_session_logout", description: "session expired by the system")
49
- # sign_out current_user
50
- # redirect_to "#{engine_path}/logout" and return
51
- # end
52
-
53
- # # check password expiration date
54
- # if current_user.has_expired_password?
55
- # unless controller_name == "profiles"
56
- # current_user.log(operation: "redirect_due_to_expired_password")
57
- # redirect_to "/administration/profile#force-password-reset", notice: I18n.t("core.users/sessions.messages_danger_password_expired")
58
- # return
59
- # end
60
- # end
61
-
62
- end
63
- end
64
- end
@@ -1,46 +0,0 @@
1
- module LesliShield
2
- module AuthorizationInterface
3
-
4
- # Check if current_user has privileges to complete this request
5
- def authorize_request
6
-
7
- # check if user has access to the requested controller
8
- # this search is over all the privileges for all the roles of the users
9
- granted = current_user.has_privileges_for?(params[:controller], params[:action])
10
-
11
-
12
- # get the path to which the user is limited to
13
- limited_path = false# current_user.has_role_limited_to_path?
14
-
15
- # to redirect to the limited path we must check:
16
- # limited_path must not to be nil or empty string ("")
17
- # limited_path must not to be equal to the current path (to avoid a loop)
18
- # request must not to be AJAX
19
- # request must be for show or index views
20
- if !limited_path.blank? and
21
- !(limited_path == request.original_fullpath) and
22
- !(request[:format] == "json") and
23
- ["show", "index"].include?(params[:action])
24
-
25
- return redirect_to(limited_path)
26
- end
27
-
28
- # privilege for object not found
29
- if granted.blank?
30
- log(
31
- :operation => :authorize_request,
32
- :description => "Privilege not found for: #{request.path}"
33
- )
34
- return respond_with_forbidden({ controller: params[:controller], action: params[:action] })
35
- end
36
-
37
- unless granted
38
- log(
39
- :operation => :authorize_request,
40
- :description => "Privilege not granted for: #{request.path}"
41
- )
42
- return respond_with_forbidden({ controller: params[:controller], action: params[:action] })
43
- end
44
- end
45
- end
46
- end