lesli_shield 1.1.7 → 1.1.8
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/stylesheets/lesli_shield/application.css +1082 -0
- data/app/assets/stylesheets/lesli_shield/invitations.css +1008 -0
- data/app/controllers/lesli_shield/invites_controller.rb +100 -49
- data/app/controllers/lesli_shield/profiles_controller.rb +9 -3
- data/app/controllers/lesli_shield/role/actions_controller.rb +134 -38
- data/app/controllers/lesli_shield/roles_controller.rb +114 -141
- data/app/controllers/lesli_shield/users_controller.rb +11 -4
- data/app/controllers/users/confirmations_controller.rb +2 -2
- data/app/controllers/users/invitations_controller.rb +101 -0
- data/app/controllers/users/passwords_controller.rb +1 -1
- data/app/controllers/users/registrations_controller.rb +2 -2
- data/app/controllers/users/sessions_controller.rb +3 -1
- data/app/jobs/lesli_shield/invitation_delivery_job.rb +123 -0
- data/app/mailers/lesli_shield/devise_mailer.rb +3 -3
- data/app/mailers/lesli_shield/invitation_mailer.rb +58 -0
- data/app/models/concerns/lesli_shield/role_management.rb +70 -0
- data/app/models/concerns/lesli_shield/user_security.rb +22 -19
- data/app/models/lesli_shield/invite.rb +183 -12
- data/app/services/lesli_shield/invitation_audit.rb +34 -0
- data/app/services/lesli_shield/invitation_email_policy.rb +64 -0
- data/app/services/lesli_shield/invitation_service.rb +405 -0
- data/app/services/lesli_shield/invite_service.rb +34 -5
- data/app/services/lesli_shield/profile_service.rb +1 -0
- data/app/services/lesli_shield/role_action_service.rb +37 -92
- data/app/services/lesli_shield/role_audit.rb +42 -0
- data/app/services/lesli_shield/role_permission_service.rb +347 -0
- data/app/services/lesli_shield/role_privilege_deployment_service.rb +79 -0
- data/app/services/lesli_shield/role_privilege_service.rb +69 -105
- data/app/services/lesli_shield/role_service.rb +431 -0
- data/app/services/lesli_shield/user_registration_service.rb +1 -1
- data/app/services/lesli_shield/user_validator_service.rb +9 -9
- data/app/views/devise/confirmations/new.html.erb +5 -5
- data/app/views/devise/confirmations/show.html.erb +3 -3
- data/app/views/devise/passwords/edit.html.erb +7 -7
- data/app/views/devise/passwords/new.html.erb +7 -7
- data/app/views/devise/registrations/new.html.erb +13 -13
- data/app/views/devise/sessions/new.html.erb +8 -8
- data/app/views/devise/shared/_demo.html.erb +3 -3
- data/app/views/devise/shared/_links.html.erb +8 -11
- data/app/views/lesli_shield/invites/_form.html.erb +64 -7
- data/app/views/lesli_shield/invites/_invite.html.erb +55 -2
- data/app/views/lesli_shield/invites/_invite_actions.html.erb +34 -0
- data/app/views/lesli_shield/invites/_status_badge.html.erb +13 -0
- data/app/views/lesli_shield/invites/index.html.erb +119 -63
- data/app/views/lesli_shield/invites/new.html.erb +11 -36
- data/app/views/lesli_shield/invites/show.html.erb +13 -52
- data/app/views/lesli_shield/profiles/_information-form.html.erb +11 -0
- data/app/views/lesli_shield/profiles/show.html.erb +1 -4
- data/app/views/lesli_shield/role/actions/_custom_actions.html.erb +24 -0
- data/app/views/lesli_shield/role/actions/_deployment_status.html.erb +14 -0
- data/app/views/lesli_shield/role/actions/_matrix.html.erb +69 -0
- data/app/views/lesli_shield/role/actions/_permissions.html.erb +95 -0
- data/app/views/lesli_shield/role/actions/_toggle.html.erb +34 -0
- data/app/views/lesli_shield/role/actions/index.html.erb +14 -10
- data/app/views/lesli_shield/roles/_deployment_badge.html.erb +15 -0
- data/app/views/lesli_shield/roles/_empty_state.html.erb +20 -0
- data/app/views/lesli_shield/roles/_field_errors.html.erb +5 -0
- data/app/views/lesli_shield/roles/_filters.html.erb +66 -0
- data/app/views/lesli_shield/roles/_form.html.erb +149 -18
- data/app/views/lesli_shield/roles/_management_menu.html.erb +37 -0
- data/app/views/lesli_shield/roles/_pagination.html.erb +43 -0
- data/app/views/lesli_shield/roles/_role_list.html.erb +116 -0
- data/app/views/lesli_shield/roles/_status_badge.html.erb +11 -0
- data/app/views/lesli_shield/roles/_type_badge.html.erb +9 -0
- data/app/views/lesli_shield/roles/index.html.erb +15 -38
- data/app/views/lesli_shield/roles/new.html.erb +11 -0
- data/app/views/lesli_shield/roles/show.html.erb +79 -7
- data/app/views/lesli_shield/users/_information-form.html.erb +6 -0
- data/app/views/users/invitations/show.html.erb +142 -0
- data/app/views/users/invitations/unavailable.html.erb +19 -0
- data/config/locales/devise.en.yml +8 -0
- data/config/locales/devise.es.yml +8 -0
- data/config/locales/translations.en.yml +313 -78
- data/config/locales/translations.es.yml +313 -78
- data/config/routes.rb +10 -3
- data/db/migrate/v1/0801120110_create_lesli_shield_invites.rb +40 -6
- data/lib/lesli_shield/engine.rb +4 -0
- data/lib/lesli_shield/router.rb +10 -0
- data/lib/lesli_shield/version.rb +2 -2
- data/lib/tasks/lesli_shield_tasks.rake +1 -1
- data/readme.md +13 -1
- metadata +35 -5
- data/app/mailers/lesli_shield/invitation.html.erb +0 -23
- data/app/views/lesli_shield/invites/edit.html.erb +0 -12
- data/app/views/lesli_shield/role/actions/_form.html.erb +0 -75
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<details class="group inline-block text-left">
|
|
2
|
+
<summary
|
|
3
|
+
class="inline-flex h-9 w-9 cursor-pointer list-none items-center justify-center rounded-lg text-slate-500 transition hover:bg-slate-100 hover:text-slate-800 focus:outline-none focus:ring-4 focus:ring-sky-500/10 [&::-webkit-details-marker]:hidden"
|
|
4
|
+
aria-label="<%= t("lesli_shield.roles.action_menu", role: role.name) %>">
|
|
5
|
+
<span class="material-symbols" aria-hidden="true">more_vert</span>
|
|
6
|
+
</summary>
|
|
7
|
+
|
|
8
|
+
<div class="absolute right-5 z-20 mt-2 w-52 overflow-hidden rounded-xl border border-slate-200 bg-white p-1.5 text-left shadow-xl">
|
|
9
|
+
<%= link_to role_path(role),
|
|
10
|
+
class: "flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium text-slate-700 transition hover:bg-slate-50 hover:text-slate-950",
|
|
11
|
+
data: { turbo_frame: "_top" } do %>
|
|
12
|
+
<span class="material-symbols text-lg" aria-hidden="true"><%= role.protected_role? ? "visibility" : "settings" %></span>
|
|
13
|
+
<span><%= role.protected_role? ? t("lesli_shield.roles.action_view") : t("lesli_shield.roles.action_manage") %></span>
|
|
14
|
+
<% end %>
|
|
15
|
+
|
|
16
|
+
<% unless role.protected_role? %>
|
|
17
|
+
<%= link_to role_actions_path(role),
|
|
18
|
+
class: "flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium text-slate-700 transition hover:bg-slate-50 hover:text-slate-950",
|
|
19
|
+
data: { turbo_frame: "_top" } do %>
|
|
20
|
+
<span class="material-symbols text-lg" aria-hidden="true">key</span>
|
|
21
|
+
<span><%= t("lesli_shield.roles.action_permissions") %></span>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% end %>
|
|
24
|
+
|
|
25
|
+
<% if role.deletable_by?(current_user) %>
|
|
26
|
+
<div class="my-1 border-t border-slate-100"></div>
|
|
27
|
+
<%= render LesliView::Elements::Button.new(
|
|
28
|
+
t("lesli_shield.roles.action_delete"), url: role_path(role),
|
|
29
|
+
method: :delete, icon: "delete", danger: true, solid: false,
|
|
30
|
+
data: {
|
|
31
|
+
turbo_confirm: t("lesli_shield.roles.confirm_delete", role: role.name),
|
|
32
|
+
turbo_submits_with: t("lesli_shield.roles.action_deleting")
|
|
33
|
+
}
|
|
34
|
+
) %>
|
|
35
|
+
<% end %>
|
|
36
|
+
</div>
|
|
37
|
+
</details>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<% if pagination[:total].positive? %>
|
|
2
|
+
<nav class="mt-6 flex flex-col gap-3 rounded-2xl border border-slate-200 bg-white px-4 py-3 shadow-sm sm:flex-row sm:items-center sm:justify-between" aria-label="<%= t("lesli_shield.roles.pagination_label") %>">
|
|
3
|
+
<p class="text-sm text-slate-600">
|
|
4
|
+
<%= t(
|
|
5
|
+
"lesli_shield.roles.pagination_summary",
|
|
6
|
+
count: pagination[:results],
|
|
7
|
+
total: pagination[:total]
|
|
8
|
+
) %>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<div class="flex items-center justify-between gap-3 sm:justify-end">
|
|
12
|
+
<% if pagination[:page] > 1 %>
|
|
13
|
+
<%= link_to t("lesli_shield.roles.pagination_previous"),
|
|
14
|
+
roles_path(request.query_parameters.merge(page: pagination[:page] - 1)),
|
|
15
|
+
class: "inline-flex h-9 items-center rounded-lg border border-slate-300 bg-white px-3 text-sm font-medium text-slate-700 transition hover:border-sky-300 hover:bg-sky-50 hover:text-sky-700",
|
|
16
|
+
data: { turbo_frame: "_top" } %>
|
|
17
|
+
<% else %>
|
|
18
|
+
<span class="inline-flex h-9 cursor-not-allowed items-center rounded-lg border border-slate-200 bg-slate-50 px-3 text-sm font-medium text-slate-400">
|
|
19
|
+
<%= t("lesli_shield.roles.pagination_previous") %>
|
|
20
|
+
</span>
|
|
21
|
+
<% end %>
|
|
22
|
+
|
|
23
|
+
<span class="text-sm font-medium text-slate-600">
|
|
24
|
+
<%= t(
|
|
25
|
+
"lesli_shield.roles.pagination_page",
|
|
26
|
+
page: pagination[:page],
|
|
27
|
+
pages: pagination[:pages]
|
|
28
|
+
) %>
|
|
29
|
+
</span>
|
|
30
|
+
|
|
31
|
+
<% if pagination[:page] < pagination[:pages] %>
|
|
32
|
+
<%= link_to t("lesli_shield.roles.pagination_next"),
|
|
33
|
+
roles_path(request.query_parameters.merge(page: pagination[:page] + 1)),
|
|
34
|
+
class: "inline-flex h-9 items-center rounded-lg border border-slate-300 bg-white px-3 text-sm font-medium text-slate-700 transition hover:border-sky-300 hover:bg-sky-50 hover:text-sky-700",
|
|
35
|
+
data: { turbo_frame: "_top" } %>
|
|
36
|
+
<% else %>
|
|
37
|
+
<span class="inline-flex h-9 cursor-not-allowed items-center rounded-lg border border-slate-200 bg-slate-50 px-3 text-sm font-medium text-slate-400">
|
|
38
|
+
<%= t("lesli_shield.roles.pagination_next") %>
|
|
39
|
+
</span>
|
|
40
|
+
<% end %>
|
|
41
|
+
</div>
|
|
42
|
+
</nav>
|
|
43
|
+
<% end %>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<div class="hidden overflow-visible rounded-2xl border border-slate-200 bg-white shadow-sm md:block">
|
|
2
|
+
<table class="min-w-full divide-y divide-slate-200">
|
|
3
|
+
<thead class="bg-slate-50">
|
|
4
|
+
<tr>
|
|
5
|
+
<% %w[role status users permissions modified_at deployment actions].each do |column| %>
|
|
6
|
+
<th scope="col" class="px-5 py-3 text-left text-xs font-semibold uppercase tracking-wide text-slate-500 <%= 'text-center' if %w[users permissions deployment actions].include?(column) %>">
|
|
7
|
+
<%= t("lesli_shield.roles.columns_#{column}") %>
|
|
8
|
+
</th>
|
|
9
|
+
<% end %>
|
|
10
|
+
</tr>
|
|
11
|
+
</thead>
|
|
12
|
+
<tbody class="divide-y divide-slate-100">
|
|
13
|
+
<% roles.each do |role| %>
|
|
14
|
+
<tr class="transition hover:bg-slate-50/80">
|
|
15
|
+
<td class="max-w-md px-5 py-4">
|
|
16
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
17
|
+
<%= link_to role.name,
|
|
18
|
+
role_path(role),
|
|
19
|
+
class: "font-semibold text-slate-900 transition hover:text-sky-700",
|
|
20
|
+
data: { turbo_frame: "_top" } %>
|
|
21
|
+
<%= render "type_badge", role: role %>
|
|
22
|
+
</div>
|
|
23
|
+
<p class="mt-1 line-clamp-2 text-sm leading-5 text-slate-500">
|
|
24
|
+
<%= role.description.presence || t("lesli_shield.roles.description_missing") %>
|
|
25
|
+
</p>
|
|
26
|
+
</td>
|
|
27
|
+
<td class="whitespace-nowrap px-5 py-4">
|
|
28
|
+
<%= render "status_badge", role: role %>
|
|
29
|
+
</td>
|
|
30
|
+
<td class="whitespace-nowrap px-5 py-4 text-center text-sm font-medium text-slate-700">
|
|
31
|
+
<%= role[:users].to_i %>
|
|
32
|
+
</td>
|
|
33
|
+
<td class="whitespace-nowrap px-5 py-4 text-center text-sm font-medium text-slate-700">
|
|
34
|
+
<%= role[:actions].to_i %>
|
|
35
|
+
</td>
|
|
36
|
+
<td class="whitespace-nowrap px-5 py-4 text-sm text-slate-600">
|
|
37
|
+
<% modified_at = role.modified_at || role.updated_at %>
|
|
38
|
+
<time datetime="<%= modified_at.iso8601 %>">
|
|
39
|
+
<%= l(modified_at, format: :short) %>
|
|
40
|
+
</time>
|
|
41
|
+
</td>
|
|
42
|
+
<td class="whitespace-nowrap px-5 py-4 text-center">
|
|
43
|
+
<%= render "deployment_badge", role: role %>
|
|
44
|
+
<% if role.deployed_at.present? %>
|
|
45
|
+
<time
|
|
46
|
+
datetime="<%= role.deployed_at.iso8601 %>"
|
|
47
|
+
class="mt-1 block text-xs text-slate-500"
|
|
48
|
+
>
|
|
49
|
+
<%= l(role.deployed_at, format: :short) %>
|
|
50
|
+
</time>
|
|
51
|
+
<% end %>
|
|
52
|
+
</td>
|
|
53
|
+
<td class="relative whitespace-nowrap px-5 py-4 text-center">
|
|
54
|
+
<%= render "management_menu", role: role %>
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<% end %>
|
|
58
|
+
</tbody>
|
|
59
|
+
</table>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div class="grid gap-4 md:hidden">
|
|
63
|
+
<% roles.each do |role| %>
|
|
64
|
+
<%
|
|
65
|
+
users_count = role[:users].to_i
|
|
66
|
+
permissions_count = role[:actions].to_i
|
|
67
|
+
users_plural = users_count == 1 ? "one" : "other"
|
|
68
|
+
permissions_plural = permissions_count == 1 ? "one" : "other"
|
|
69
|
+
%>
|
|
70
|
+
<article class="rounded-2xl border border-slate-200 bg-white p-5 shadow-sm">
|
|
71
|
+
<div class="flex items-start justify-between gap-3">
|
|
72
|
+
<div class="min-w-0">
|
|
73
|
+
<h2 class="truncate text-base font-semibold text-slate-900"><%= role.name %></h2>
|
|
74
|
+
<p class="mt-1 line-clamp-2 text-sm leading-5 text-slate-500">
|
|
75
|
+
<%= role.description.presence || t("lesli_shield.roles.description_missing") %>
|
|
76
|
+
</p>
|
|
77
|
+
</div>
|
|
78
|
+
<%= render "status_badge", role: role %>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div class="mt-4 flex flex-wrap gap-2">
|
|
82
|
+
<%= render "type_badge", role: role %>
|
|
83
|
+
<span class="inline-flex items-center gap-1 rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600">
|
|
84
|
+
<span class="material-symbols text-base" aria-hidden="true">group</span>
|
|
85
|
+
<%= t("lesli_shield.roles.mobile_users_#{users_plural}", count: users_count) %>
|
|
86
|
+
</span>
|
|
87
|
+
<span class="inline-flex items-center gap-1 rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600">
|
|
88
|
+
<span class="material-symbols text-base" aria-hidden="true">key</span>
|
|
89
|
+
<%= t("lesli_shield.roles.mobile_permissions_#{permissions_plural}", count: permissions_count) %>
|
|
90
|
+
</span>
|
|
91
|
+
<%= render "deployment_badge", role: role %>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<% modified_at = role.modified_at || role.updated_at %>
|
|
95
|
+
<p class="mt-4 text-xs text-slate-500">
|
|
96
|
+
<%= t(
|
|
97
|
+
"lesli_shield.roles.mobile_modified_at",
|
|
98
|
+
date: l(modified_at, format: :short)
|
|
99
|
+
) %>
|
|
100
|
+
</p>
|
|
101
|
+
<% if role.deployed_at.present? %>
|
|
102
|
+
<p class="mt-1 text-xs text-slate-500">
|
|
103
|
+
<%= t(
|
|
104
|
+
"lesli_shield.roles.mobile_deployed_at",
|
|
105
|
+
date: l(role.deployed_at, format: :short)
|
|
106
|
+
) %>
|
|
107
|
+
</p>
|
|
108
|
+
<% end %>
|
|
109
|
+
|
|
110
|
+
<%= render LesliView::Elements::Button.new(
|
|
111
|
+
role.protected_role? ? t("lesli_shield.roles.action_view") : t("lesli_shield.roles.action_manage"),
|
|
112
|
+
url: role_path(role), css_class: "mt-4 w-full"
|
|
113
|
+
) %>
|
|
114
|
+
</article>
|
|
115
|
+
<% end %>
|
|
116
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<% if role.active? %>
|
|
2
|
+
<span class="inline-flex items-center gap-1.5 rounded-full bg-emerald-50 px-2.5 py-1 text-xs font-semibold text-emerald-700 ring-1 ring-inset ring-emerald-600/20">
|
|
3
|
+
<span class="h-1.5 w-1.5 rounded-full bg-emerald-500" aria-hidden="true"></span>
|
|
4
|
+
<%= t("lesli_shield.roles.statuses_active") %>
|
|
5
|
+
</span>
|
|
6
|
+
<% else %>
|
|
7
|
+
<span class="inline-flex items-center gap-1.5 rounded-full bg-slate-100 px-2.5 py-1 text-xs font-semibold text-slate-600 ring-1 ring-inset ring-slate-500/20">
|
|
8
|
+
<span class="h-1.5 w-1.5 rounded-full bg-slate-400" aria-hidden="true"></span>
|
|
9
|
+
<%= t("lesli_shield.roles.statuses_inactive") %>
|
|
10
|
+
</span>
|
|
11
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% if role.system_role? %>
|
|
2
|
+
<span class="inline-flex items-center rounded-full bg-violet-50 px-2.5 py-1 text-xs font-semibold text-violet-700 ring-1 ring-inset ring-violet-600/20">
|
|
3
|
+
<%= t("lesli_shield.roles.types_system") %>
|
|
4
|
+
</span>
|
|
5
|
+
<% else %>
|
|
6
|
+
<span class="inline-flex items-center rounded-full bg-sky-50 px-2.5 py-1 text-xs font-semibold text-sky-700 ring-1 ring-inset ring-sky-600/20">
|
|
7
|
+
<%= t("lesli_shield.roles.types_custom") %>
|
|
8
|
+
</span>
|
|
9
|
+
<% end %>
|
|
@@ -1,41 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
<%
|
|
3
|
-
columns = [{
|
|
4
|
-
field: "id",
|
|
5
|
-
label: "ID"
|
|
6
|
-
},{
|
|
7
|
-
field: "name",
|
|
8
|
-
label: "Name",
|
|
9
|
-
sort: true
|
|
10
|
-
}, {
|
|
11
|
-
field: "users",
|
|
12
|
-
label: "Users",
|
|
13
|
-
align: "center",
|
|
14
|
-
sort: true
|
|
15
|
-
}, {
|
|
16
|
-
field: "actions",
|
|
17
|
-
label: "Actions",
|
|
18
|
-
align: "center",
|
|
19
|
-
sort: true
|
|
20
|
-
}, {
|
|
21
|
-
field: "isolated",
|
|
22
|
-
label: "Isolated",
|
|
23
|
-
sort: true
|
|
24
|
-
}, {
|
|
25
|
-
field: "active",
|
|
26
|
-
label: "Active",
|
|
27
|
-
sort: true
|
|
28
|
-
}]
|
|
29
|
-
%>
|
|
30
2
|
<%= render LesliView::Layout::Container.new("shield-roles") do %>
|
|
31
|
-
<%= render LesliView::Components::Header.new(
|
|
32
|
-
|
|
33
|
-
|
|
3
|
+
<%= render LesliView::Components::Header.new(
|
|
4
|
+
t("lesli_shield.roles.title"),
|
|
5
|
+
t("lesli_shield.roles.subtitle")
|
|
6
|
+
) do %>
|
|
7
|
+
<%= render(LesliView::Elements::Button.new(t("lesli_shield.roles.action_create"), :icon=>'add', :url=>new_role_path)) %>
|
|
34
8
|
<% end %>
|
|
35
|
-
|
|
36
|
-
<%= render
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<%
|
|
9
|
+
|
|
10
|
+
<%= render "filters", filters: @filters %>
|
|
11
|
+
|
|
12
|
+
<% if @roles.fetch(:records).any? %>
|
|
13
|
+
<%= render "role_list", roles: @roles.fetch(:records) %>
|
|
14
|
+
<%= render "pagination", pagination: @roles.fetch(:pagination) %>
|
|
15
|
+
<% else %>
|
|
16
|
+
<%= render "empty_state", filters: @filters %>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%= render LesliView::Layout::Container.new("shield-roles-new") do %>
|
|
2
|
+
<%= render LesliView::Components::Header.new(
|
|
3
|
+
t("lesli_shield.roles.new_title"),
|
|
4
|
+
t("lesli_shield.roles.new_description"),
|
|
5
|
+
back: roles_path
|
|
6
|
+
) %>
|
|
7
|
+
|
|
8
|
+
<div class="w-full rounded-2xl border border-slate-200 bg-white p-5 shadow-sm sm:p-8">
|
|
9
|
+
<%= render "form" %>
|
|
10
|
+
</div>
|
|
11
|
+
<% end %>
|
|
@@ -1,10 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<%
|
|
2
|
+
members_count = @role_summary.fetch(:members)
|
|
3
|
+
members_plural = members_count == 1 ? "one" : "other"
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
<%= render LesliView::Layout::Container.new("shield-role-detail") do %>
|
|
7
|
+
<%= render LesliView::Components::Header.new(
|
|
8
|
+
@role.name,
|
|
9
|
+
@role.description.presence || t("lesli_shield.roles.description_missing"),
|
|
10
|
+
back: roles_path
|
|
11
|
+
) do %>
|
|
12
|
+
<%= render LesliView::Elements::Button.new(
|
|
13
|
+
t("lesli_shield.roles.detail_view_members"), icon: "group", url: users_path
|
|
14
|
+
) %>
|
|
15
|
+
<% unless @role.protected_role? %>
|
|
16
|
+
<%= render LesliView::Elements::Button.new(
|
|
17
|
+
t("lesli_shield.roles.detail_manage_permissions"), icon: "key", url: role_actions_path(@role)
|
|
18
|
+
) %>
|
|
19
|
+
<% end %>
|
|
20
|
+
<%= render LesliView::Elements::Button.new(
|
|
21
|
+
t("lesli_shield.roles.action_duplicate"),
|
|
22
|
+
icon: "content_copy", url: duplicate_role_path(@role), method: :post,
|
|
23
|
+
data: { turbo_submits_with: t("lesli_shield.roles.action_duplicating") }
|
|
24
|
+
) %>
|
|
25
|
+
|
|
7
26
|
<% end %>
|
|
8
27
|
|
|
9
|
-
|
|
28
|
+
<%
|
|
29
|
+
navigation_items = [{ label: t("lesli_shield.roles.detail_summary_title"), path: role_path(@role), selected: true }]
|
|
30
|
+
unless @role.protected_role?
|
|
31
|
+
navigation_items << { label: t("lesli_shield.roles.detail_manage_permissions"), path: role_actions_path(@role), selected: false }
|
|
32
|
+
end
|
|
33
|
+
%>
|
|
34
|
+
<div class="flex min-w-0 flex-col gap-6 lg:flex-row lg:items-start">
|
|
35
|
+
<%= render LesliView::Layout::NavigationSidebar.new(items: navigation_items, label: @role.name) %>
|
|
36
|
+
<div id="role-detail-content" class="min-w-0 flex-1 space-y-6">
|
|
37
|
+
<section id="members" class="rounded-2xl border border-slate-200 bg-white p-5 shadow-sm sm:p-6" aria-labelledby="role-summary-title">
|
|
38
|
+
<div class="flex items-center justify-between gap-3">
|
|
39
|
+
<h2 id="role-summary-title" class="text-base font-semibold text-slate-900">
|
|
40
|
+
<%= t("lesli_shield.roles.detail_summary_title") %>
|
|
41
|
+
</h2>
|
|
42
|
+
<%= render "status_badge", role: @role %>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<dl class="mt-3 flex flex-wrap gap-8">
|
|
46
|
+
<div>
|
|
47
|
+
<dt class="text-xs font-medium uppercase tracking-wide text-slate-500">
|
|
48
|
+
<%= t("lesli_shield.roles.detail_members") %>
|
|
49
|
+
</dt>
|
|
50
|
+
<dd class="mt-1 text-2xl font-semibold text-slate-900">
|
|
51
|
+
<%= @role_summary.fetch(:members) %>
|
|
52
|
+
</dd>
|
|
53
|
+
</div>
|
|
54
|
+
<div>
|
|
55
|
+
<dt class="text-xs font-medium uppercase tracking-wide text-slate-500">
|
|
56
|
+
<%= t("lesli_shield.roles.detail_permissions") %>
|
|
57
|
+
</dt>
|
|
58
|
+
<dd class="mt-1 text-2xl font-semibold text-slate-900">
|
|
59
|
+
<%= @role_summary.fetch(:permissions) %>
|
|
60
|
+
</dd>
|
|
61
|
+
</div>
|
|
62
|
+
</dl>
|
|
63
|
+
|
|
64
|
+
<div class="mt-5 border-t border-slate-200 pt-5">
|
|
65
|
+
<h3 id="role-status-title" class="text-sm font-semibold text-slate-800">
|
|
66
|
+
<%= t("lesli_shield.roles.detail_status_title") %>
|
|
67
|
+
</h3>
|
|
68
|
+
<p class="mt-2 text-sm leading-6 text-slate-500">
|
|
69
|
+
<%= @role.active? ?
|
|
70
|
+
t("lesli_shield.roles.detail_active_impact_#{members_plural}", count: members_count) :
|
|
71
|
+
t("lesli_shield.roles.detail_inactive_impact_#{members_plural}", count: members_count) %>
|
|
72
|
+
</p>
|
|
73
|
+
</div>
|
|
74
|
+
</section>
|
|
75
|
+
|
|
76
|
+
<section id="general" class="rounded-2xl border border-slate-200 bg-white p-5 shadow-sm sm:p-8">
|
|
77
|
+
<%= render "form" %>
|
|
78
|
+
</section>
|
|
79
|
+
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
10
82
|
<% end %>
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
<%= form.field_control(:first_name) %>
|
|
15
15
|
<%= form.field_control(:last_name) %>
|
|
16
16
|
<%= form.field_control(:telephone) %>
|
|
17
|
+
<%= form.field_control_select(:time_zone,
|
|
18
|
+
TZInfo::Timezone.all_identifiers.sort.map { |zone| [zone, zone] },
|
|
19
|
+
humanize: false,
|
|
20
|
+
label: t("lesli_shield.profiles.time_zone"),
|
|
21
|
+
message: t("lesli_shield.profiles.time_zone_help"),
|
|
22
|
+
options: { include_blank: t("lesli_shield.profiles.time_zone_default") }) %>
|
|
17
23
|
<hr/>
|
|
18
24
|
<%= form.field_control_submit %>
|
|
19
25
|
<% end %>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<%
|
|
2
|
+
title = I18n.t("lesli_shield.invites.acceptance_title")
|
|
3
|
+
%>
|
|
4
|
+
|
|
5
|
+
<%= render(
|
|
6
|
+
"devise/shared/application-devise",
|
|
7
|
+
title: title,
|
|
8
|
+
back_to_login: true
|
|
9
|
+
) do %>
|
|
10
|
+
<p class="mb-6 text-center text-sm leading-6 text-slate-600">
|
|
11
|
+
<%= I18n.t(
|
|
12
|
+
"lesli_shield.invites.acceptance_description",
|
|
13
|
+
account: @invitation.account.account.name
|
|
14
|
+
) %>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<dl class="mb-6 overflow-hidden rounded-lg border border-slate-200 bg-slate-50 text-sm">
|
|
18
|
+
<div class="grid grid-cols-3 gap-4 border-b border-slate-200 px-4 py-3">
|
|
19
|
+
<dt class="font-medium text-slate-500">
|
|
20
|
+
<%= I18n.t("lesli_shield.invites.acceptance_organization") %>
|
|
21
|
+
</dt>
|
|
22
|
+
<dd class="col-span-2 font-medium text-slate-900">
|
|
23
|
+
<%= @invitation.account.account.name %>
|
|
24
|
+
</dd>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="grid grid-cols-3 gap-4 px-4 py-3">
|
|
27
|
+
<dt class="font-medium text-slate-500">
|
|
28
|
+
<%= I18n.t("lesli_shield.invites.acceptance_role") %>
|
|
29
|
+
</dt>
|
|
30
|
+
<dd class="col-span-2 font-medium text-slate-900">
|
|
31
|
+
<%= @invitation.role.name %>
|
|
32
|
+
</dd>
|
|
33
|
+
</div>
|
|
34
|
+
</dl>
|
|
35
|
+
|
|
36
|
+
<%= form_for(
|
|
37
|
+
@user,
|
|
38
|
+
as: :user,
|
|
39
|
+
url: user_invitation_path,
|
|
40
|
+
method: :patch,
|
|
41
|
+
html: { class: "text-left" },
|
|
42
|
+
builder: LesliView::Forms::Builder
|
|
43
|
+
) do |form| %>
|
|
44
|
+
<%= hidden_field_tag :invitation_token, @invitation_token %>
|
|
45
|
+
|
|
46
|
+
<%= render "devise/shared/error_messages", resource: @user %>
|
|
47
|
+
|
|
48
|
+
<%= form.field_control_email(
|
|
49
|
+
:email,
|
|
50
|
+
label: I18n.t("lesli_shield.invites.acceptance_email"),
|
|
51
|
+
icon: "mail",
|
|
52
|
+
readonly: true,
|
|
53
|
+
autocomplete: "email"
|
|
54
|
+
) %>
|
|
55
|
+
|
|
56
|
+
<%= form.field_control(
|
|
57
|
+
:first_name,
|
|
58
|
+
label: I18n.t("lesli_shield.invites.acceptance_first_name"),
|
|
59
|
+
message: @user.errors[:first_name].to_sentence.presence,
|
|
60
|
+
category: @user.errors[:first_name].any? ? :danger : nil,
|
|
61
|
+
autocomplete: "given-name",
|
|
62
|
+
required: true
|
|
63
|
+
) %>
|
|
64
|
+
|
|
65
|
+
<%= form.field_control(
|
|
66
|
+
:last_name,
|
|
67
|
+
label: I18n.t("lesli_shield.invites.acceptance_last_name"),
|
|
68
|
+
message: @user.errors[:last_name].to_sentence.presence,
|
|
69
|
+
category: @user.errors[:last_name].any? ? :danger : nil,
|
|
70
|
+
autocomplete: "family-name",
|
|
71
|
+
required: true
|
|
72
|
+
) %>
|
|
73
|
+
|
|
74
|
+
<%= form.field_control(
|
|
75
|
+
:telephone,
|
|
76
|
+
label: "#{I18n.t("lesli_shield.invites.acceptance_telephone")} " \
|
|
77
|
+
"(#{I18n.t("lesli_shield.invites.acceptance_optional")})",
|
|
78
|
+
message: @user.errors[:telephone].to_sentence.presence,
|
|
79
|
+
category: @user.errors[:telephone].any? ? :danger : nil,
|
|
80
|
+
autocomplete: "tel"
|
|
81
|
+
) %>
|
|
82
|
+
|
|
83
|
+
<div class="mb-4 rounded-xl border border-sky-100 bg-sky-50 px-4 py-3" role="note">
|
|
84
|
+
<p class="text-sm font-semibold text-sky-900">
|
|
85
|
+
<%= I18n.t("lesli_shield.invites.acceptance_password_requirements") %>
|
|
86
|
+
</p>
|
|
87
|
+
<p class="mt-1 text-sm leading-5 text-sky-700">
|
|
88
|
+
<%= I18n.t(
|
|
89
|
+
"lesli_shield.invites.acceptance_password_length",
|
|
90
|
+
minimum: @minimum_password_length,
|
|
91
|
+
maximum: Devise.password_length.max
|
|
92
|
+
) %>
|
|
93
|
+
</p>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<%= form.field_control_password(
|
|
97
|
+
:password,
|
|
98
|
+
label: I18n.t("lesli_shield.invites.acceptance_password"),
|
|
99
|
+
message: @user.errors[:password].to_sentence.presence ||
|
|
100
|
+
I18n.t(
|
|
101
|
+
"lesli_shield.invites.acceptance_password_hint",
|
|
102
|
+
minimum: @minimum_password_length,
|
|
103
|
+
maximum: Devise.password_length.max
|
|
104
|
+
),
|
|
105
|
+
category: @user.errors[:password].any? ? :danger : nil,
|
|
106
|
+
icon: "key",
|
|
107
|
+
autocomplete: "new-password",
|
|
108
|
+
required: true,
|
|
109
|
+
minlength: @minimum_password_length,
|
|
110
|
+
maxlength: Devise.password_length.max,
|
|
111
|
+
value: ""
|
|
112
|
+
) %>
|
|
113
|
+
|
|
114
|
+
<%= form.field_control_password(
|
|
115
|
+
:password_confirmation,
|
|
116
|
+
label: I18n.t(
|
|
117
|
+
"lesli_shield.invites.acceptance_password_confirmation"
|
|
118
|
+
),
|
|
119
|
+
message: @user.errors[:password_confirmation].to_sentence.presence,
|
|
120
|
+
category: @user.errors[:password_confirmation].any? ? :danger : nil,
|
|
121
|
+
icon: "key",
|
|
122
|
+
autocomplete: "new-password",
|
|
123
|
+
required: true,
|
|
124
|
+
minlength: @minimum_password_length,
|
|
125
|
+
maxlength: Devise.password_length.max,
|
|
126
|
+
value: ""
|
|
127
|
+
) %>
|
|
128
|
+
|
|
129
|
+
<%= form.field_control_button(
|
|
130
|
+
I18n.t("lesli_shield.invites.acceptance_action"),
|
|
131
|
+
{
|
|
132
|
+
class: "w-full",
|
|
133
|
+
data: {
|
|
134
|
+
turbo_submits_with: I18n.t(
|
|
135
|
+
"lesli_shield.invites.acceptance_submitting"
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
icon: "person_add"
|
|
140
|
+
) %>
|
|
141
|
+
<% end %>
|
|
142
|
+
<% end %>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<%= render(
|
|
2
|
+
"devise/shared/application-devise",
|
|
3
|
+
title: @invitation_error_title,
|
|
4
|
+
back_to_login: true
|
|
5
|
+
) do %>
|
|
6
|
+
<section class="rounded-2xl border border-slate-200 bg-white p-6 text-center shadow-sm" role="alert">
|
|
7
|
+
<div class="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-amber-50 text-amber-700">
|
|
8
|
+
<svg class="h-6 w-6" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
|
9
|
+
<path d="M12 8v5m0 3.5v.01M10.3 4.4 3.6 16a2 2 0 0 0 1.7 3h13.4a2 2 0 0 0 1.7-3L13.7 4.4a2 2 0 0 0-3.4 0Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/>
|
|
10
|
+
</svg>
|
|
11
|
+
</div>
|
|
12
|
+
<p class="mt-4 text-sm leading-6 text-slate-600">
|
|
13
|
+
<%= @invitation_error_description %>
|
|
14
|
+
</p>
|
|
15
|
+
<%= link_to I18n.t("actions.back_to_login", default: "Back to login"),
|
|
16
|
+
new_user_session_path,
|
|
17
|
+
class: "mt-6 inline-flex h-11 w-full items-center justify-center rounded-xl bg-sky-600 px-4 text-sm font-semibold text-white shadow-sm transition hover:bg-sky-700 focus:outline-none focus:ring-4 focus:ring-sky-500/20" %>
|
|
18
|
+
</section>
|
|
19
|
+
<% end %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
en:
|
|
3
|
+
devise:
|
|
4
|
+
confirmations:
|
|
5
|
+
confirmed: "Your email address has been confirmed successfully. You can now log in."
|
|
6
|
+
send_paranoid_instructions: "If your account is awaiting confirmation, you will receive a new confirmation link in a few minutes."
|
|
7
|
+
registrations:
|
|
8
|
+
signed_up_but_invalid: "Account created. Check your email to continue."
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
es:
|
|
3
|
+
devise:
|
|
4
|
+
confirmations:
|
|
5
|
+
confirmed: "Tu correo electrónico fue confirmado correctamente. Ya puedes iniciar sesión."
|
|
6
|
+
send_paranoid_instructions: "Si tu cuenta está pendiente de confirmación, recibirás un nuevo enlace en unos minutos."
|
|
7
|
+
registrations:
|
|
8
|
+
signed_up_but_invalid: "Cuenta creada. Revisa tu correo electrónico para continuar."
|