lesli_shield 1.1.1 → 1.1.3

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.
@@ -1,31 +1 @@
1
- @charset "UTF-8";
2
- /*
3
- Lesli
4
1
 
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
- */
@@ -32,16 +32,10 @@ Building a better future, one line of code at a time.
32
32
 
33
33
  module LesliShield
34
34
  class RolesController < ApplicationController
35
- before_action :set_role, only: %i[ show update destroy ]
35
+ before_action :set_role, only: %i[ show update destroy deploy ]
36
36
 
37
37
  def deploy
38
- pp params[:id]
39
- pp params[:id]
40
- pp params[:id]
41
- pp params[:id]
42
-
43
- RolePrivilegeService.new.synchronize(Lesli::Role.first)
44
-
38
+ RolePrivilegeService.new.synchronize(@role.result)
45
39
  respond_with_lesli(
46
40
  :turbo => stream_notification_success("success")
47
41
  )
@@ -57,7 +57,7 @@ module LesliShield
57
57
  active: true
58
58
  ).exists?
59
59
  rescue => exception
60
- L2.danger(exception.to_s)
60
+ Termline.danger(exception.to_s)
61
61
  return false
62
62
  end
63
63
  end
@@ -21,20 +21,21 @@ module LesliShield
21
21
 
22
22
  Role::Action.with_deleted.joins(action: :parent)
23
23
  .where(:role_id => role_id)
24
+ .order('parents_lesli_resources.route')
24
25
  .select(
25
26
  :id,
26
27
  :role_id,
27
28
  :deleted_at,
28
29
  "parents_lesli_resources.id as controller_id",
29
30
  "parents_lesli_resources.label as controller_name",
31
+ "parents_lesli_resources.route as controller_route",
30
32
  "lesli_resources.action as action_name",
31
33
  "lesli_resources.id as action_id",
32
34
  "case when lesli_shield_role_actions.deleted_at is null then TRUE else FALSE end active"
33
35
  ).each do |action|
34
36
 
35
- unless role_actions.has_key?(action[:controller_name])
36
- role_actions[action[:controller_name]] = {
37
- list:nil,
37
+ unless role_actions.has_key?(action[:controller_route])
38
+ role_actions[action[:controller_route]] = {
38
39
  index: nil,
39
40
  show:nil,
40
41
  create:nil,
@@ -43,28 +44,24 @@ module LesliShield
43
44
  }
44
45
  end
45
46
 
46
- if action[:action_name] == "list"
47
- role_actions[action[:controller_name]][:list] = clean(action)
48
- end
49
-
50
47
  if action[:action_name] == "index"
51
- role_actions[action[:controller_name]][:index] = clean(action)
48
+ role_actions[action[:controller_route]][:index] = clean(action)
52
49
  end
53
50
 
54
51
  if action[:action_name] == "show"
55
- role_actions[action[:controller_name]][:show] = clean(action)
52
+ role_actions[action[:controller_route]][:show] = clean(action)
56
53
  end
57
54
 
58
55
  if action[:action_name] == "create"
59
- role_actions[action[:controller_name]][:create] = clean(action)
56
+ role_actions[action[:controller_route]][:create] = clean(action)
60
57
  end
61
58
 
62
59
  if action[:action_name] == "update"
63
- role_actions[action[:controller_name]][:update] = clean(action)
60
+ role_actions[action[:controller_route]][:update] = clean(action)
64
61
  end
65
62
 
66
63
  if action[:action_name] == "destroy"
67
- role_actions[action[:controller_name]][:destroy] = clean(action)
64
+ role_actions[action[:controller_route]][:destroy] = clean(action)
68
65
  end
69
66
  end
70
67
 
@@ -62,7 +62,7 @@ module LesliShield
62
62
  lesli_shield_role_actions.role_id as role_id,
63
63
  resource_controllers.route as controller,
64
64
  resource_actions.action as action,
65
- lesli_shield_role_actions.deleted_at IS NULL as active
65
+ case when lesli_shield_role_actions.deleted_at is null then TRUE else FALSE end active
66
66
  )).with_deleted
67
67
 
68
68
  # get privileges only for the given role, this is needed to sync only modified roles
@@ -3,7 +3,7 @@
3
3
 
4
4
  Lesli
5
5
 
6
- Copyright (c) 2023, Lesli Technologies, S. A.
6
+ Copyright (c) 2026, Lesli Technologies, S. A.
7
7
 
8
8
  This program is free software: you can redistribute it and/or modify
9
9
  it under the terms of the GNU General Public License as published by
@@ -18,9 +18,9 @@ GNU General Public License for more details.
18
18
  You should have received a copy of the GNU General Public License
19
19
  along with this program. If not, see http://www.gnu.org/licenses/.
20
20
 
21
- Lesli · Ruby on Rails SaaS development platform.
21
+ Lesli · Ruby on Rails SaaS Development Framework.
22
22
 
23
- Made with ♥ by https://www.lesli.tech
23
+ Made with ♥ by LesliTech
24
24
  Building a better future, one line of code at a time.
25
25
 
26
26
  @contact hello@lesli.tech
@@ -40,8 +40,8 @@ Building a better future, one line of code at a time.
40
40
  <%# Logo container %>
41
41
  <div class="logo mb-4">
42
42
  <%= image_tag(
43
- "#{lesli_instance_code}/brand/app-auth.svg", # dynamic path to the instance main logo
44
- :class => "#{lesli_instance_code}-logo", # dynamic class according to the instance
43
+ "lesli_assets/brand/app-auth.svg",
44
+ :class => "#{lesli_instance_code}-logo",
45
45
  :alt => "Main logo")
46
46
  %>
47
47
  <h1 class="title is-size-4 has-text-primary">
@@ -2,7 +2,7 @@
2
2
 
3
3
  Lesli
4
4
 
5
- Copyright (c) 2025, Lesli Technologies, S. A.
5
+ Copyright (c) 2026, Lesli Technologies, S. A.
6
6
 
7
7
  This program is free software: you can redistribute it and/or modify
8
8
  it under the terms of the GNU General Public License as published by
@@ -54,8 +54,8 @@ Building a better future, one line of code at a time.
54
54
  <%# Logo container %>
55
55
  <div class="logo has-text-centered mb-6">
56
56
  <%= image_tag(
57
- "lesli_assets/brand/app-auth.svg", # dynamic path to the instance main logo
58
- :class => "#{lesli_instance_code}-logo mb-2", # dynamic class according to the instance
57
+ "lesli_assets/brand/app-auth.svg",
58
+ :class => "#{lesli_instance_code}-logo mb-2",
59
59
  :alt => "Main logo")
60
60
  %>
61
61
  <h1 class="is-title is-size-3 has-text-primary">
@@ -2,8 +2,6 @@
2
2
  <%
3
3
  columns = [{
4
4
  label: "Controller"
5
- }, {
6
- label: "List"
7
5
  }, {
8
6
  label: "Index"
9
7
  }, {
@@ -14,8 +12,6 @@ columns = [{
14
12
  label: "Update"
15
13
  }, {
16
14
  label: "Destroy"
17
- }, {
18
- label: ""
19
15
  }]
20
16
  %>
21
17
 
@@ -1,4 +1,4 @@
1
1
  module LesliShield
2
- VERSION = "1.1.1"
3
- BUILD = "1777174912"
2
+ VERSION = "1.1.3"
3
+ BUILD = "1777771350"
4
4
  end
@@ -39,10 +39,9 @@ namespace :lesli_shield do
39
39
 
40
40
  # Drop, build, migrate & seed database (development only)
41
41
  def lesli_shield_privileges
42
-
43
42
  Lesli::Role.all.each do |role|
44
- Termline.info("LesliShield: Syncing privileges for #{role.name} role.")
45
43
  LesliShield::RolePrivilegeService.new(nil).synchronize(role)
44
+ Termline.success("LesliShield: Syncing privileges for #{role.name} role.")
46
45
  end
47
46
  end
48
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_shield
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team