lesli_shield 1.1.8 → 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.
- checksums.yaml +4 -4
- data/app/assets/images/lesli_shield/login-background.webp +0 -0
- data/app/assets/images/lesli_shield/register-background.webp +0 -0
- data/app/assets/stylesheets/lesli_shield/application.css +325 -408
- data/app/assets/stylesheets/lesli_shield/confirmations.css +89 -557
- data/app/assets/stylesheets/lesli_shield/invitations.css +116 -580
- data/app/assets/stylesheets/lesli_shield/passwords.css +76 -542
- data/app/assets/stylesheets/lesli_shield/registrations.css +96 -544
- data/app/assets/stylesheets/lesli_shield/sessions.css +99 -565
- data/app/controllers/lesli_shield/profile/passwords_controller.rb +0 -2
- data/app/controllers/lesli_shield/profiles_controller.rb +0 -1
- data/app/controllers/lesli_shield/user/roles_controller.rb +35 -59
- data/app/controllers/lesli_shield/users_controller.rb +4 -2
- data/app/controllers/users/registrations_controller.rb +27 -0
- data/app/controllers/users/sessions_controller.rb +11 -0
- data/app/interfaces/lesli_shield/security_interface.rb +146 -0
- data/app/models/concerns/lesli_shield/user_authentication.rb +0 -29
- data/app/models/concerns/lesli_shield/user_legal_acceptance.rb +45 -0
- data/app/models/concerns/lesli_shield/user_security.rb +23 -14
- data/app/services/lesli_shield/user_role_service.rb +37 -0
- data/app/services/lesli_shield/user_validator_service.rb +6 -28
- data/app/views/devise/confirmations/new.html.erb +1 -1
- data/app/views/devise/confirmations/show.html.erb +3 -3
- data/app/views/devise/passwords/edit.html.erb +1 -1
- data/app/views/devise/passwords/new.html.erb +2 -2
- data/app/views/devise/registrations/_terms.html.erb +34 -0
- data/app/views/devise/registrations/new.html.erb +5 -7
- data/app/views/devise/sessions/new.html.erb +3 -2
- data/app/views/devise/shared/_application-devise-simple.erb +1 -1
- data/app/views/devise/shared/_application-devise.html.erb +4 -4
- data/app/views/devise/shared/_demo.html.erb +2 -2
- data/app/views/devise/shared/_error_messages.html.erb +5 -5
- data/app/views/devise/shared/_links.html.erb +4 -4
- data/app/views/lesli_shield/invites/_invite.html.erb +9 -9
- data/app/views/lesli_shield/invites/_invite_actions.html.erb +3 -3
- data/app/views/lesli_shield/invites/_status_badge.html.erb +4 -4
- data/app/views/lesli_shield/invites/index.html.erb +20 -20
- data/app/views/lesli_shield/partials/_navigation.html.erb +5 -5
- data/app/views/lesli_shield/profiles/_password-form.html.erb +1 -1
- data/app/views/lesli_shield/role/actions/_custom_actions.html.erb +7 -7
- data/app/views/lesli_shield/role/actions/_deployment_status.html.erb +2 -2
- data/app/views/lesli_shield/role/actions/_matrix.html.erb +13 -13
- data/app/views/lesli_shield/role/actions/_permissions.html.erb +9 -9
- data/app/views/lesli_shield/role/actions/_toggle.html.erb +3 -3
- data/app/views/lesli_shield/role/actions/index.html.erb +0 -1
- data/app/views/lesli_shield/roles/_deployment_badge.html.erb +3 -3
- data/app/views/lesli_shield/roles/_empty_state.html.erb +4 -4
- data/app/views/lesli_shield/roles/_field_errors.html.erb +1 -1
- data/app/views/lesli_shield/roles/_filters.html.erb +9 -9
- data/app/views/lesli_shield/roles/_form.html.erb +22 -22
- data/app/views/lesli_shield/roles/_management_menu.html.erb +5 -5
- data/app/views/lesli_shield/roles/_pagination.html.erb +7 -7
- data/app/views/lesli_shield/roles/_role_list.html.erb +19 -19
- data/app/views/lesli_shield/roles/_status_badge.html.erb +4 -4
- data/app/views/lesli_shield/roles/_type_badge.html.erb +2 -2
- data/app/views/lesli_shield/roles/new.html.erb +1 -1
- data/app/views/lesli_shield/roles/show.html.erb +40 -50
- data/app/views/lesli_shield/user/roles/index.html.erb +1 -16
- data/app/views/lesli_shield/users/_information-card.html.erb +3 -3
- data/app/views/lesli_shield/users/_management-privileges.html.erb +74 -68
- data/app/views/lesli_shield/users/show.html.erb +1 -1
- data/app/views/users/invitations/show.html.erb +10 -10
- data/app/views/users/invitations/unavailable.html.erb +4 -4
- data/config/locales/translations.en.yml +8 -1
- data/config/locales/translations.es.yml +8 -1
- data/config/locales/user_roles.en.yml +16 -0
- data/config/locales/user_roles.es.yml +16 -0
- data/config/routes.rb +1 -1
- data/lib/lesli_shield/engine.rb +4 -0
- data/lib/lesli_shield/version.rb +2 -2
- metadata +10 -12
- data/app/assets/images/lesli_shield/login-background.jpg +0 -0
- data/app/assets/images/lesli_shield/register-background.jpg +0 -0
- data/app/assets/stylesheets/lesli_shield/confirmations.tailwind.css +0 -918
- data/app/assets/stylesheets/lesli_shield/devise/oauth.css +0 -33
- data/app/assets/stylesheets/lesli_shield/passwords.tailwind.css +0 -873
- data/app/assets/stylesheets/lesli_shield/registrations.tailwind.css +0 -908
- data/app/assets/stylesheets/lesli_shield/sessions.tailwind.css +0 -984
- data/app/assets/stylesheets/lesli_shield/users.css +0 -31
- data/app/interfaces/lesli_shield/authentication_interface.rb +0 -64
- data/app/interfaces/lesli_shield/authorization_interface.rb +0 -46
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
@charset "UTF-8";
|
|
2
|
-
/*
|
|
3
|
-
Lesli
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
-
|
|
7
|
-
This program is free software: you can redistribute it and/or modify
|
|
8
|
-
it under the terms of the GNU General Public License as published by
|
|
9
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
(at your option) any later version.
|
|
11
|
-
|
|
12
|
-
This program is distributed in the hope that it will be useful,
|
|
13
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
GNU General Public License for more details.
|
|
16
|
-
|
|
17
|
-
You should have received a copy of the GNU General Public License
|
|
18
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
-
|
|
20
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
21
|
-
|
|
22
|
-
Made with ♥ by https://www.lesli.tech
|
|
23
|
-
Building a better future, one line of code at a time.
|
|
24
|
-
|
|
25
|
-
@contact hello@lesli.tech
|
|
26
|
-
@website https://www.lesli.tech
|
|
27
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
-
|
|
29
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
-
// ·
|
|
31
|
-
*/
|
|
@@ -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
|