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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10ebb40b1f83e7bf7a2970d8a9f67c082a2f7a47446130dd969ab209bfb34344
4
- data.tar.gz: 37bec10c5fa241c51a01ab3a036ef97441c2224d256ef3ad45befff5c4c6183c
3
+ metadata.gz: fd8f1c5df89887b46bab72012b2666557494075ee96e97e863f29fdeebb7f2a6
4
+ data.tar.gz: 9e95da883fc1f074fbebadb0eacfeee9e578263cb51b1c8e42c21e9827601ddf
5
5
  SHA512:
6
- metadata.gz: 394cfe9a65d5fcfb3eadd7495c24e5b740aade1867b570ae5b536480916aa030599e49222ca1f36c91286ece0828980e7ad7720df54b4122cf1e7e000d82dfb3
7
- data.tar.gz: fcb499c3ae098e2cd520fa54b421c9131143b97e5f700ec52acc62c10d34016898438e68bd38a3148dba5765d3a79869ce6c69ff4ea2e799c6ee51f946317def
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 < ApplicationLesliController
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::AuthenticationInterface if defined?(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 :use_user_timezone
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 :log_requests if defined?(LesliAudit)
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 use_user_timezone(&action)
76
- # Keep the profile zone scoped to this request, including services and views.
77
- user = current_user if respond_to?(:current_user, true)
78
- zone = user ? user.effective_time_zone :
79
- Time.find_zone!(Lesli.config.datetime&.dig(:time_zone).presence || Rails.application.config.time_zone)
80
- Time.use_zone(zone, &action)
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 = current_user.account.admin&.settings
11
- &.where(name: "lesli_theme_color_primary", user_id: nil)
12
- &.pick(:value)
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
- # locale = current_user.locale if warden.authenticated?
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
@@ -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
- if defined?(LesliBell)
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
- label = if notifications_count.positive?
41
- plural = notifications_count == 1 ? "one" : "other"
42
- t("lesli.header.notifications_unread_#{plural}", count: notifications_count, default: "%{count} unread notifications")
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, label: label, active: current_page?(path),
48
- icon: notifications_count.positive? ? "ri-notification-3-fill" : "ri-notification-3-line",
49
- highlighted: notifications_count.positive?, count: notifications_count,
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
- actions << {
55
- url: lesli.apps_path, label: t("lesli.header.applications", default: "Applications"),
56
- icon: "ri-apps-2-line", active: current_page?(lesli.apps_path),
57
- data: { turbo_frame: "_top" }
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, label: t("lesli.header.profile", default: "Profile"),
63
- icon: "ri-user-smile-line", data: { turbo_frame: "_top" }
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, label: t("lesli.header.logout", default: "Logout"),
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
- notifications_unread_one: "%{count} unread notification"
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
- notifications_unread_one: "%{count} notificación sin leer"
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
@@ -35,8 +35,6 @@ Lesli::Engine.routes.draw do
35
35
 
36
36
  resource :apps, only: [:show]
37
37
 
38
- resource :about, only: [:show]
39
-
40
38
  resources :resources, only: [:index]
41
39
 
42
40
  get :language, to: "apps#language"
@@ -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
@@ -1,4 +1,4 @@
1
1
  module Lesli
2
- VERSION = "5.1.15"
2
+ VERSION = "5.1.16"
3
3
  BUILD = "1795131688"
4
4
  end
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.15
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-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: 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
- %>