lesli 5.1.15 → 5.1.16
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/controllers/lesli/abouts_controller.rb +1 -28
- data/app/controllers/lesli/application_lesli_controller.rb +14 -11
- data/app/helpers/lesli/navigation_helper.rb +10 -1
- data/app/interfaces/lesli/customization_interface.rb +3 -3
- data/app/interfaces/lesli/requester_interface.rb +5 -1
- data/app/models/concerns/lesli/user_extensions.rb +10 -15
- data/app/models/lesli/user.rb +0 -5
- data/app/views/lesli/layouts/application-lesli.html.erb +0 -1
- data/app/views/lesli/partials/_application-lesli-header.html.erb +35 -17
- data/config/initializers/lesli.rb +8 -0
- data/config/locales/translations.en.yml +1 -2
- data/config/locales/translations.es.yml +1 -2
- data/config/routes.rb +0 -2
- data/db/migrate/v1/0000000210_create_lesli_users.rb +8 -0
- data/lib/lesli/version.rb +1 -1
- metadata +2 -3
- data/app/views/lesli/partials/_application-lesli-data.html.erb +0 -41
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd8f1c5df89887b46bab72012b2666557494075ee96e97e863f29fdeebb7f2a6
|
|
4
|
+
data.tar.gz: 9e95da883fc1f074fbebadb0eacfeee9e578263cb51b1c8e42c21e9827601ddf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d99b413f9491a657f5cd6b6991eea0d0d2fc1c87588d21d5229741695a6c0a4c3a0150cf02ecd570ff67d6bafc79f5645cc72e85064496c994ed239857d1d108
|
|
7
|
+
data.tar.gz: 4c78f2cabe5931649df3ddc8ab3b4f810c3fd56541b7f950465f8a78ab69c91983d90950729bf0006c22e307016834507e0943adb7b2b5b49b0b6b5eadd2cd1a
|
|
@@ -31,38 +31,11 @@ Building a better future, one line of code at a time.
|
|
|
31
31
|
=end
|
|
32
32
|
|
|
33
33
|
module Lesli
|
|
34
|
-
class AboutsController <
|
|
34
|
+
class AboutsController < ApplicationController
|
|
35
35
|
layout "lesli/layouts/application-public", only: [:welcome]
|
|
36
36
|
|
|
37
|
-
skip_before_action :authenticate_request, only: [:welcome] if defined?(LesliShield)
|
|
38
|
-
skip_before_action :authorize_request, only: [:welcome] if defined?(LesliShield)
|
|
39
|
-
|
|
40
37
|
def welcome
|
|
41
38
|
# renders the welcome page
|
|
42
39
|
end
|
|
43
|
-
|
|
44
|
-
def up
|
|
45
|
-
# renders the health check page
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# GET /status
|
|
49
|
-
def show
|
|
50
|
-
respond_to do |format|
|
|
51
|
-
format.html {}
|
|
52
|
-
format.json do
|
|
53
|
-
lesli_engines = ::LesliSystem.engines.map do |engine, engine_info|
|
|
54
|
-
{
|
|
55
|
-
:name => engine_info[:name],
|
|
56
|
-
:code => engine_info[:code],
|
|
57
|
-
:path => engine_info[:path],
|
|
58
|
-
:build => engine_info[:build],
|
|
59
|
-
:version => engine_info[:version],
|
|
60
|
-
:description => engine_info[:description]
|
|
61
|
-
}
|
|
62
|
-
end
|
|
63
|
-
respond_with_json(lesli_engines)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
40
|
end
|
|
68
41
|
end
|
|
@@ -37,8 +37,7 @@ module Lesli
|
|
|
37
37
|
include Lesli::ResponderInterface
|
|
38
38
|
include Lesli::CustomizationInterface
|
|
39
39
|
include LesliAudit::LoggerInterface if defined?(LesliAudit)
|
|
40
|
-
include LesliShield::
|
|
41
|
-
include LesliShield::AuthorizationInterface if defined?(LesliShield)
|
|
40
|
+
include LesliShield::SecurityInterface if defined?(LesliShield)
|
|
42
41
|
|
|
43
42
|
# Controllers from isolated engines inherit this controller, but Rails
|
|
44
43
|
# does not automatically expose Lesli's helpers to their views.
|
|
@@ -46,14 +45,16 @@ module Lesli
|
|
|
46
45
|
|
|
47
46
|
protect_from_forgery with: :exception
|
|
48
47
|
|
|
49
|
-
around_action :
|
|
50
|
-
before_action :set_locale
|
|
48
|
+
around_action :set_privileges if defined?(LesliShield)
|
|
51
49
|
before_action :authenticate_request if defined?(LesliShield)
|
|
52
50
|
before_action :authorize_request if defined?(LesliShield)
|
|
53
51
|
before_action :set_customizer
|
|
54
52
|
before_action :set_requester
|
|
53
|
+
before_action :set_timezone
|
|
54
|
+
before_action :set_locale
|
|
55
|
+
before_action :load_notifications
|
|
55
56
|
before_action :load_announcements
|
|
56
|
-
after_action
|
|
57
|
+
after_action :log_requests if defined?(LesliAudit)
|
|
57
58
|
|
|
58
59
|
layout "lesli/layouts/application-lesli"
|
|
59
60
|
|
|
@@ -72,12 +73,14 @@ module Lesli
|
|
|
72
73
|
|
|
73
74
|
private
|
|
74
75
|
|
|
75
|
-
def
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
def load_notifications
|
|
77
|
+
@lesli[:notifications] = 0
|
|
78
|
+
return unless request.format.html? && !turbo_frame_request?
|
|
79
|
+
return unless respond_to?(:current_user, true) && current_user
|
|
80
|
+
|
|
81
|
+
@lesli[:notifications] = Lesli::Courier.new(:lesli_bell, 0)
|
|
82
|
+
.from(:notification_service, current_user)
|
|
83
|
+
.call(:count)
|
|
81
84
|
end
|
|
82
85
|
|
|
83
86
|
def load_announcements
|
|
@@ -62,8 +62,17 @@ module Lesli
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
# Screen permissions also control navigation. Without Shield, Core
|
|
66
|
+
# keeps the navigation available to the host application's own policy.
|
|
67
|
+
def navigation_allowed?(controller, action = :index)
|
|
68
|
+
return true unless defined?(LesliShield)
|
|
69
|
+
|
|
70
|
+
current_user&.has_privileges_for?(controller.to_s, action.to_s) || false
|
|
71
|
+
end
|
|
72
|
+
|
|
65
73
|
# Prints a html link inside a list item
|
|
66
|
-
def navigation_item(path, label, icon = nil, reload: false)
|
|
74
|
+
def navigation_item(path, label, icon = nil, reload: false, access: nil)
|
|
75
|
+
return if access && !navigation_allowed?(*access)
|
|
67
76
|
content_tag(:li) do
|
|
68
77
|
navigation_link(path, label, icon, reload:reload)
|
|
69
78
|
end
|
|
@@ -7,9 +7,9 @@ module Lesli
|
|
|
7
7
|
return unless request.format.html? || request.format.pdf?
|
|
8
8
|
return unless defined?(LesliAdmin) && respond_to?(:current_user, true) && current_user
|
|
9
9
|
|
|
10
|
-
color =
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
color = Lesli::Courier.new(:lesli_admin)
|
|
11
|
+
.from(:theme_operator, current_user)
|
|
12
|
+
.call(:primary_color)
|
|
13
13
|
|
|
14
14
|
# Only emit a hex color. Missing or invalid settings keep the CSS fallback.
|
|
15
15
|
return unless color.to_s.match?(/\A#(?:\h{3}|\h{6})\z/)
|
|
@@ -46,7 +46,7 @@ module Lesli
|
|
|
46
46
|
# if user is not authenticated; For some scenarios we need to have control of the behavior
|
|
47
47
|
# for not authenticated user requests, thats why here we go deeper and check if user is
|
|
48
48
|
# authenticated checking the warden storage
|
|
49
|
-
|
|
49
|
+
locale = current_user.effective_locale if warden.authenticated?
|
|
50
50
|
|
|
51
51
|
# language defined in the http header request
|
|
52
52
|
locale = request.headers["Require-Language"] unless request.headers["Require-Language"].blank?
|
|
@@ -58,6 +58,10 @@ module Lesli
|
|
|
58
58
|
I18n.locale = locale
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
def set_timezone
|
|
62
|
+
LesliDate.time_zone = current_user.effective_timezone
|
|
63
|
+
end
|
|
64
|
+
|
|
61
65
|
# Set default query params for:
|
|
62
66
|
def set_requester
|
|
63
67
|
@query = {
|
|
@@ -63,26 +63,21 @@ module Lesli
|
|
|
63
63
|
initials
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
# Returns the local configuration for the user,
|
|
67
|
-
# if there is no locale the default local of the platform will be returned
|
|
68
|
-
def locale
|
|
69
|
-
user_locale = self.settings.find_by(name: "locale")
|
|
70
|
-
|
|
71
|
-
# return the desire locale by the user
|
|
72
|
-
return user_locale.value.to_sym if user_locale
|
|
73
|
-
|
|
74
|
-
# create a desire locale if the record does not exist
|
|
75
|
-
self.settings.create_with(:value => I18n.locale).find_or_create_by(:name => "locale")
|
|
76
|
-
|
|
77
|
-
# reevaluate
|
|
78
|
-
self.locale()
|
|
79
|
-
end
|
|
80
|
-
|
|
81
66
|
# Return a string with the names of all the roles assigned to the user
|
|
82
67
|
def role_names
|
|
83
68
|
self.roles.pluck(:name).join(', ')
|
|
84
69
|
end
|
|
85
70
|
|
|
71
|
+
# Resolve the display zone without storing the fallback as a user preference.
|
|
72
|
+
def effective_timezone
|
|
73
|
+
Time.find_zone!(time_zone || Lesli.config.datetime&.dig(:time_zone).presence || Rails.application.config.time_zone)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# A missing preference follows the application's configured default.
|
|
77
|
+
def effective_locale
|
|
78
|
+
locale.presence || I18n.default_locale.to_s
|
|
79
|
+
end
|
|
80
|
+
|
|
86
81
|
# Register a audit log for the current user
|
|
87
82
|
def log(
|
|
88
83
|
engine:nil, # must be MyEngine
|
data/app/models/lesli/user.rb
CHANGED
|
@@ -74,11 +74,6 @@ module Lesli
|
|
|
74
74
|
|
|
75
75
|
before_create :before_create_user
|
|
76
76
|
|
|
77
|
-
# Resolve the display zone without storing the fallback as a user preference.
|
|
78
|
-
def effective_time_zone
|
|
79
|
-
Time.find_zone!(time_zone || Lesli.config.datetime&.dig(:time_zone).presence || Rails.application.config.time_zone)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
77
|
private
|
|
83
78
|
|
|
84
79
|
def before_create_user
|
|
@@ -34,7 +34,6 @@ Building a better future, one line of code at a time.
|
|
|
34
34
|
<html lang="en">
|
|
35
35
|
<head>
|
|
36
36
|
<%= render(partial: "lesli/partials/application-lesli-head") %>
|
|
37
|
-
<%= render(partial: "lesli/partials/application-lesli-data") %>
|
|
38
37
|
<%= render(partial: "lesli/partials/application-lesli-turbo") %>
|
|
39
38
|
<%= render(partial: "lesli/partials/application-lesli-assets") %>
|
|
40
39
|
<%= render(partial: "lesli/partials/application-lesli-analytics") %>
|
|
@@ -32,38 +32,56 @@ Building a better future, one line of code at a time.
|
|
|
32
32
|
|
|
33
33
|
<%
|
|
34
34
|
engine_navigation_partial = navigation_partial
|
|
35
|
-
notifications_count = @lesli&.dig(:notifications).to_i
|
|
36
35
|
actions = []
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
# Notifications use the count already prepared by the controller.
|
|
38
|
+
if defined?(LesliBell) && navigation_allowed?("lesli_bell/notifications", :index)
|
|
39
|
+
count = @lesli&.dig(:notifications).to_i
|
|
40
|
+
unread = count.positive?
|
|
39
41
|
path = lesli_bell.notifications_path
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
t("lesli.header.
|
|
42
|
+
|
|
43
|
+
label = if unread
|
|
44
|
+
t("lesli.header.notifications_unread_notifications", count: count)
|
|
43
45
|
else
|
|
44
46
|
t("lesli.header.notifications", default: "Notifications")
|
|
45
47
|
end
|
|
48
|
+
|
|
46
49
|
actions << {
|
|
47
|
-
url: path,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
url: path,
|
|
51
|
+
label: label,
|
|
52
|
+
icon: unread ? "ri-notification-3-fill" : "ri-notification-3-line",
|
|
53
|
+
active: current_page?(path),
|
|
54
|
+
highlighted: unread,
|
|
55
|
+
count: count,
|
|
50
56
|
data: { turbo_frame: "_top" }
|
|
51
57
|
}
|
|
52
58
|
end
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
if navigation_allowed?("lesli/apps", :show)
|
|
61
|
+
actions << {
|
|
62
|
+
url: lesli.apps_path,
|
|
63
|
+
label: t("lesli.header.applications", default: "Applications"),
|
|
64
|
+
icon: "ri-apps-2-line",
|
|
65
|
+
active: current_page?(lesli.apps_path),
|
|
66
|
+
data: { turbo_frame: "_top" }
|
|
67
|
+
}
|
|
68
|
+
end
|
|
59
69
|
|
|
60
|
-
if defined?(LesliShield)
|
|
70
|
+
if defined?(LesliShield) && navigation_allowed?("lesli_shield/profiles", :show)
|
|
61
71
|
actions << {
|
|
62
|
-
url: lesli_shield.profile_path,
|
|
63
|
-
|
|
72
|
+
url: lesli_shield.profile_path,
|
|
73
|
+
label: t("lesli.header.profile", default: "Profile"),
|
|
74
|
+
icon: "ri-user-smile-line",
|
|
75
|
+
data: { turbo_frame: "_top" }
|
|
64
76
|
}
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Signing out does not require a role privilege.
|
|
81
|
+
if defined?(LesliShield)
|
|
65
82
|
actions << {
|
|
66
|
-
url: main_app.destroy_user_session_path,
|
|
83
|
+
url: main_app.destroy_user_session_path,
|
|
84
|
+
label: t("lesli.header.logout", default: "Logout"),
|
|
67
85
|
icon: "ri-logout-circle-r-line"
|
|
68
86
|
}
|
|
69
87
|
end
|
|
@@ -121,6 +121,14 @@ Lesli.configure do |config|
|
|
|
121
121
|
path_after_login: defined?(LesliDashboard) ? "/dashboard" : "/",
|
|
122
122
|
default_role: "guest",
|
|
123
123
|
|
|
124
|
+
# Optional legal acceptance for public registration. The host owns the
|
|
125
|
+
# documents and must provide both URLs and versions when enabled.
|
|
126
|
+
require_terms_acceptance: false,
|
|
127
|
+
terms_url: nil,
|
|
128
|
+
terms_version: nil,
|
|
129
|
+
privacy_url: nil,
|
|
130
|
+
privacy_version: nil,
|
|
131
|
+
|
|
124
132
|
# Invitations verify ownership of the recipient's email address. The
|
|
125
133
|
# invited user does not exist until the signed link is accepted.
|
|
126
134
|
invitation_expiration: 7.days
|
|
@@ -16,8 +16,7 @@ en:
|
|
|
16
16
|
dashboard: "Lesli Dashboard"
|
|
17
17
|
logout: "Logout"
|
|
18
18
|
notifications: "Notifications"
|
|
19
|
-
|
|
20
|
-
notifications_unread_other: "%{count} unread notifications"
|
|
19
|
+
notifications_unread_notifications: "%{count} unread notifications"
|
|
21
20
|
profile: "Profile"
|
|
22
21
|
items:
|
|
23
22
|
activities_empty: "No activities have been recorded yet."
|
|
@@ -16,8 +16,7 @@ es:
|
|
|
16
16
|
dashboard: "Panel de Lesli"
|
|
17
17
|
logout: "Cerrar sesión"
|
|
18
18
|
notifications: "Notificaciones"
|
|
19
|
-
|
|
20
|
-
notifications_unread_other: "%{count} notificaciones sin leer"
|
|
19
|
+
notifications_unread_notifications: "%{count} notificaciones sin leer"
|
|
21
20
|
profile: "Perfil"
|
|
22
21
|
items:
|
|
23
22
|
activities_empty: "Todavía no se ha registrado actividad."
|
data/config/routes.rb
CHANGED
|
@@ -46,8 +46,16 @@ class CreateLesliUsers < ActiveRecord::Migration[7.2]
|
|
|
46
46
|
t.string :salutation
|
|
47
47
|
t.string :first_name
|
|
48
48
|
t.string :last_name
|
|
49
|
+
|
|
50
|
+
t.string :locale
|
|
49
51
|
t.string :time_zone
|
|
50
52
|
|
|
53
|
+
# Legal acceptance, recorded by registration flows that require it.
|
|
54
|
+
# Nullable fields allow users created without an acceptance record.
|
|
55
|
+
t.datetime :terms_accepted_at
|
|
56
|
+
t.string :terms_version
|
|
57
|
+
t.string :privacy_version
|
|
58
|
+
|
|
51
59
|
# Authenticable
|
|
52
60
|
t.string :email, null: false, default: ""
|
|
53
61
|
t.string :encrypted_password, null: false, default: ""
|
data/lib/lesli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lesli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.1.
|
|
4
|
+
version: 5.1.16
|
|
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-
|
|
11
|
+
date: 2026-11-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -225,7 +225,6 @@ files:
|
|
|
225
225
|
- app/views/lesli/partials/_application-lesli-announcements.html.erb
|
|
226
226
|
- app/views/lesli/partials/_application-lesli-assets.html.erb
|
|
227
227
|
- app/views/lesli/partials/_application-lesli-content.html.erb
|
|
228
|
-
- app/views/lesli/partials/_application-lesli-data.html.erb
|
|
229
228
|
- app/views/lesli/partials/_application-lesli-head.html.erb
|
|
230
229
|
- app/views/lesli/partials/_application-lesli-header.html.erb
|
|
231
230
|
- app/views/lesli/partials/_application-lesli-navigation.html.erb
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<%#
|
|
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 LesliTech
|
|
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
|
-
%>
|
|
32
|
-
|
|
33
|
-
<%
|
|
34
|
-
|
|
35
|
-
# Defining color customization
|
|
36
|
-
# colors will be override with the ones defined in the database if custom colors exists
|
|
37
|
-
# if there is no custom colors defined, the var() function will return the lesli colors
|
|
38
|
-
#@lesli.dig(:customization, :colors) || {}
|
|
39
|
-
@lesli[:notifications] = Lesli::Courier.new(:lesli_bell, 0).from(:notification_service, current_user).call(:count)
|
|
40
|
-
|
|
41
|
-
%>
|