lesli_security 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +38 -0
- data/app/assets/config/lesli_security_manifest.js +38 -0
- data/app/assets/images/lesli_security/security-logo.svg +57 -0
- data/app/assets/javascripts/lesli_security/application.js +5583 -0
- data/app/assets/stylesheets/lesli_security/application.css +95 -0
- data/app/controllers/lesli_security/accounts_controller.rb +60 -0
- data/app/controllers/lesli_security/application_controller.rb +37 -0
- data/app/controllers/lesli_security/dashboard/components_controller.rb +60 -0
- data/app/controllers/lesli_security/dashboards_controller.rb +36 -0
- data/app/controllers/lesli_security/descriptor/activities_controller.rb +122 -0
- data/app/controllers/lesli_security/descriptor/privileges_controller.rb +112 -0
- data/app/controllers/lesli_security/descriptors_controller.rb +129 -0
- data/app/controllers/lesli_security/role/activities_controller.rb +76 -0
- data/app/controllers/lesli_security/role/descriptors_controller.rb +97 -0
- data/app/controllers/lesli_security/role/privileges_controller.rb +47 -0
- data/app/controllers/lesli_security/roles_controller.rb +185 -0
- data/app/controllers/lesli_security/user/roles_controller.rb +98 -0
- data/app/controllers/lesli_security/user/sessions_controller.rb +71 -0
- data/app/controllers/lesli_security/users_controller.rb +206 -0
- data/app/helpers/lesli_security/accounts_helper.rb +4 -0
- data/app/helpers/lesli_security/application_helper.rb +4 -0
- data/app/helpers/lesli_security/dashboards_helper.rb +4 -0
- data/app/helpers/lesli_security/descriptor/activities_helper.rb +4 -0
- data/app/helpers/lesli_security/descriptor/privileges_helper.rb +4 -0
- data/app/helpers/lesli_security/descriptors_helper.rb +4 -0
- data/app/helpers/lesli_security/role/activities_helper.rb +4 -0
- data/app/helpers/lesli_security/role/descriptors_helper.rb +4 -0
- data/app/helpers/lesli_security/role/privileges_helper.rb +4 -0
- data/app/helpers/lesli_security/roles_helper.rb +4 -0
- data/app/jobs/lesli_security/application_job.rb +37 -0
- data/app/mailers/lesli_security/application_mailer.rb +39 -0
- data/app/models/lesli_security/account.rb +43 -0
- data/app/models/lesli_security/application_record.rb +37 -0
- data/app/models/lesli_security/dashboard/component.rb +42 -0
- data/app/models/lesli_security/dashboard.rb +58 -0
- data/app/models/lesli_security/descriptor/activity.rb +40 -0
- data/app/models/lesli_security/descriptor/privilege.rb +40 -0
- data/app/models/lesli_security/descriptor.rb +41 -0
- data/app/models/lesli_security/role/activity.rb +40 -0
- data/app/services/lesli_security/descriptor_privilege_service.rb +74 -0
- data/app/services/lesli_security/descriptor_service.rb +152 -0
- data/app/services/lesli_security/role_descriptor_service.rb +61 -0
- data/app/services/lesli_security/role_service.rb +215 -0
- data/app/services/lesli_security/user_service.rb +305 -0
- data/app/views/lesli_security/accounts/_account.html.erb +2 -0
- data/app/views/lesli_security/accounts/_form.html.erb +17 -0
- data/app/views/lesli_security/accounts/edit.html.erb +10 -0
- data/app/views/lesli_security/accounts/index.html.erb +14 -0
- data/app/views/lesli_security/accounts/new.html.erb +9 -0
- data/app/views/lesli_security/accounts/show.html.erb +10 -0
- data/app/views/lesli_security/dashboards/show.html.erb +1 -0
- data/app/views/lesli_security/descriptor/activities/_form.html.erb +32 -0
- data/app/views/lesli_security/descriptor/activities/edit.html.erb +34 -0
- data/app/views/lesli_security/descriptor/activities/index.html.erb +34 -0
- data/app/views/lesli_security/descriptor/activities/new.html.erb +34 -0
- data/app/views/lesli_security/descriptor/activities/show.html.erb +34 -0
- data/app/views/lesli_security/descriptor/privileges/_form.html.erb +32 -0
- data/app/views/lesli_security/descriptor/privileges/edit.html.erb +34 -0
- data/app/views/lesli_security/descriptor/privileges/index.html.erb +34 -0
- data/app/views/lesli_security/descriptor/privileges/new.html.erb +34 -0
- data/app/views/lesli_security/descriptor/privileges/show.html.erb +34 -0
- data/app/views/lesli_security/descriptors/_form.html.erb +32 -0
- data/app/views/lesli_security/descriptors/edit.html.erb +34 -0
- data/app/views/lesli_security/descriptors/index.html.erb +34 -0
- data/app/views/lesli_security/descriptors/new.html.erb +34 -0
- data/app/views/lesli_security/descriptors/show.html.erb +34 -0
- data/app/views/lesli_security/partials/_engine-navigation.html.erb +38 -0
- data/app/views/lesli_security/role/activities/_form.html.erb +32 -0
- data/app/views/lesli_security/role/activities/edit.html.erb +34 -0
- data/app/views/lesli_security/role/activities/index.html.erb +34 -0
- data/app/views/lesli_security/role/activities/new.html.erb +34 -0
- data/app/views/lesli_security/role/activities/show.html.erb +34 -0
- data/app/views/lesli_security/role/descriptors/_form.html.erb +32 -0
- data/app/views/lesli_security/role/descriptors/edit.html.erb +34 -0
- data/app/views/lesli_security/role/descriptors/index.html.erb +34 -0
- data/app/views/lesli_security/role/descriptors/new.html.erb +34 -0
- data/app/views/lesli_security/role/descriptors/show.html.erb +34 -0
- data/app/views/lesli_security/role/privileges/_form.html.erb +32 -0
- data/app/views/lesli_security/role/privileges/edit.html.erb +34 -0
- data/app/views/lesli_security/role/privileges/index.html.erb +34 -0
- data/app/views/lesli_security/role/privileges/new.html.erb +34 -0
- data/app/views/lesli_security/role/privileges/show.html.erb +34 -0
- data/app/views/lesli_security/roles/edit.html.erb +34 -0
- data/app/views/lesli_security/roles/index.html.erb +34 -0
- data/app/views/lesli_security/roles/new.html.erb +34 -0
- data/app/views/lesli_security/roles/show.html.erb +34 -0
- data/app/views/lesli_security/users/edit.html.erb +10 -0
- data/app/views/lesli_security/users/index.html.erb +34 -0
- data/app/views/lesli_security/users/new.html.erb +34 -0
- data/app/views/lesli_security/users/show.html.erb +1 -0
- data/config/locales/translations.en.yml +44 -0
- data/config/locales/translations.es.yml +44 -0
- data/config/locales/translations.fr.yml +44 -0
- data/config/locales/translations.it.yml +44 -0
- data/config/locales/translations.pt.yml +44 -0
- data/config/routes.rb +90 -0
- data/db/migrate/v1/0010000210_create_lesli_roles.rb +60 -0
- data/db/migrate/v1/0010000310_create_lesli_users.rb +97 -0
- data/db/migrate/v1/0010003010_create_lesli_user_details.rb +49 -0
- data/db/migrate/v1/0010003110_create_lesli_user_settings.rb +44 -0
- data/db/migrate/v1/0010003210_create_lesli_user_sessions.rb +55 -0
- data/db/migrate/v1/0010003410_create_lesli_user_powers.rb +43 -0
- data/db/migrate/v1/0010004010_create_lesli_user_logs.rb +45 -0
- data/db/migrate/v1/0010005010_create_lesli_descriptors.rb +44 -0
- data/db/migrate/v1/0010005110_create_lesli_descriptor_privileges.rb +45 -0
- data/db/migrate/v1/0010005210_create_lesli_descriptor_activities.rb +49 -0
- data/db/migrate/v1/0010005510_create_lesli_role_powers.rb +51 -0
- data/db/migrate/v1/0010005710_create_lesli_role_privileges.rb +45 -0
- data/db/migrate/v1/0802000110_create_lesli_security_accounts.rb +42 -0
- data/db/migrate/v1/0802050110_create_lesli_security_dashboards.rb +51 -0
- data/db/migrate/v1/0802050210_create_lesli_security_dashboard_components.rb +53 -0
- data/lib/lesli_security/engine.rb +18 -0
- data/lib/lesli_security/version.rb +4 -0
- data/lib/lesli_security.rb +6 -0
- data/lib/scss/application.scss +38 -0
- data/lib/scss/users.scss +67 -0
- data/lib/tasks/lesli_security_tasks.rake +50 -0
- data/lib/vue/application.js +112 -0
- data/lib/vue/apps/descriptors/components/form.vue +136 -0
- data/lib/vue/apps/descriptors/edit.vue +83 -0
- data/lib/vue/apps/descriptors/index.vue +113 -0
- data/lib/vue/apps/descriptors/new.vue +69 -0
- data/lib/vue/apps/descriptors/show.vue +233 -0
- data/lib/vue/apps/roles/components/descriptors.vue +81 -0
- data/lib/vue/apps/roles/components/form.vue +253 -0
- data/lib/vue/apps/roles/components/privilegeCustom.vue +86 -0
- data/lib/vue/apps/roles/components/privilegeStandard.vue +196 -0
- data/lib/vue/apps/roles/edit.vue +118 -0
- data/lib/vue/apps/roles/index.vue +168 -0
- data/lib/vue/apps/roles/logs.vue +110 -0
- data/lib/vue/apps/roles/new.vue +86 -0
- data/lib/vue/apps/roles/show.vue +109 -0
- data/lib/vue/apps/users/components/information-card.vue +104 -0
- data/lib/vue/apps/users/components/information-form.vue +176 -0
- data/lib/vue/apps/users/components/integrations-information.vue +61 -0
- data/lib/vue/apps/users/components/management-roles.vue +107 -0
- data/lib/vue/apps/users/components/management-security.vue +113 -0
- data/lib/vue/apps/users/components/management-sessions.vue +101 -0
- data/lib/vue/apps/users/components/management-settings.vue +93 -0
- data/lib/vue/apps/users/index.vue +207 -0
- data/lib/vue/apps/users/new.vue +181 -0
- data/lib/vue/apps/users/show.vue +131 -0
- data/lib/vue/stores/descriptor.js +117 -0
- data/lib/vue/stores/descriptors.js +156 -0
- data/lib/vue/stores/role.js +203 -0
- data/lib/vue/stores/roles.js +58 -0
- data/lib/vue/stores/translations.json +277 -0
- data/lib/vue/stores/user.js +331 -0
- data/lib/vue/stores/users.js +166 -0
- data/license +674 -0
- data/readme.md +76 -0
- metadata +225 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
class CreateLesliRolePrivileges < ActiveRecord::Migration[7.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_role_privileges do |t|
|
36
|
+
t.string :controller
|
37
|
+
t.string :action
|
38
|
+
t.boolean :active
|
39
|
+
t.datetime :deleted_at, index: true
|
40
|
+
t.timestamps
|
41
|
+
end
|
42
|
+
add_reference(:lesli_role_privileges, :role, foreign_key: { to_table: :lesli_roles })
|
43
|
+
add_index(:lesli_role_privileges, %i[controller action role_id], unique: true, name: "role_privileges_index")
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
class CreateLesliSecurityAccounts < ActiveRecord::Migration[6.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_security_accounts do |t|
|
36
|
+
t.integer :status
|
37
|
+
t.datetime :deleted_at, index: true
|
38
|
+
t.timestamps
|
39
|
+
end
|
40
|
+
add_reference(:lesli_security_accounts, :account, foreign_key: { to_table: :lesli_accounts })
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
class CreateLesliSecurityDashboards < ActiveRecord::Migration[6.1]
|
34
|
+
def change
|
35
|
+
gem_path = Lesli::System.engine("Lesli", "dir")
|
36
|
+
table_base_structure = JSON.parse(File.read(File.join(gem_path, "db", "structure", "00000501_dashboards.json")))
|
37
|
+
create_table :lesli_security_dashboards do |t|
|
38
|
+
table_base_structure.each do |column|
|
39
|
+
t.send(
|
40
|
+
column["type"].parameterize.underscore.to_sym,
|
41
|
+
column["name"].parameterize.underscore.to_sym
|
42
|
+
)
|
43
|
+
end
|
44
|
+
t.timestamps
|
45
|
+
end
|
46
|
+
|
47
|
+
add_reference(:lesli_security_dashboards, :account, foreign_key: { to_table: :lesli_security_accounts })
|
48
|
+
add_reference(:lesli_security_dashboards, :user, foreign_key: { to_table: :lesli_users })
|
49
|
+
#add_reference(:lesli_admin_dashboards, :role, foreign_key: { to_table: :roles })
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
|
33
|
+
class CreateLesliSecurityDashboardComponents < ActiveRecord::Migration[6.1]
|
34
|
+
def change
|
35
|
+
gem_path = Lesli::System.engine("Lesli", "dir")
|
36
|
+
table_base_structure = JSON.parse(File.read(File.join(gem_path, "db", "structure", "00000502_dashboard_components.json")))
|
37
|
+
create_table :lesli_security_dashboard_components do |t|
|
38
|
+
table_base_structure.each do |column|
|
39
|
+
t.send(
|
40
|
+
column["type"].parameterize.underscore.to_sym,
|
41
|
+
column["name"].parameterize.underscore.to_sym
|
42
|
+
)
|
43
|
+
end
|
44
|
+
t.timestamps
|
45
|
+
end
|
46
|
+
|
47
|
+
add_reference(
|
48
|
+
:lesli_security_dashboard_components, :dashboard,
|
49
|
+
foreign_key: { to_table: :lesli_security_dashboards },
|
50
|
+
index: { name: "lesli_security_dashboard_components_index" }
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module LesliSecurity
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace LesliSecurity
|
4
|
+
|
5
|
+
initializer :lesli_security do |app|
|
6
|
+
|
7
|
+
# register assets manifest
|
8
|
+
config.assets.precompile += %w[lesli_security_manifest.js]
|
9
|
+
|
10
|
+
# register engine migrations path
|
11
|
+
unless app.root.to_s.match root.to_s
|
12
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
13
|
+
app.config.paths["db/migrate"] << expanded_path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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 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
|
+
|
33
|
+
|
34
|
+
|
35
|
+
// ·
|
36
|
+
body.lesli-guard-users {
|
37
|
+
@import "./users";
|
38
|
+
}
|
data/lib/scss/users.scss
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
/*
|
2
|
+
Lesli
|
3
|
+
|
4
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
5
|
+
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU General Public License
|
17
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
18
|
+
|
19
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
20
|
+
|
21
|
+
Made with ♥ by https://www.lesli.tech
|
22
|
+
Building a better future, one line of code at a time.
|
23
|
+
|
24
|
+
@contact hello@lesli.tech
|
25
|
+
@website https://www.lesli.tech
|
26
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
27
|
+
|
28
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
29
|
+
// ·
|
30
|
+
*/
|
31
|
+
|
32
|
+
|
33
|
+
// ·
|
34
|
+
.user-information-card {
|
35
|
+
figure {
|
36
|
+
display: flex;
|
37
|
+
align-items: center;
|
38
|
+
justify-content: center;
|
39
|
+
border-radius: 50%;
|
40
|
+
background-color: lesli-css-color(silver, 100);
|
41
|
+
border: 2px solid var(--lesli-color-primary, lesli-css-color(blue));
|
42
|
+
}
|
43
|
+
.alternative-avatar {
|
44
|
+
font-weight: 200;
|
45
|
+
font-size: 3rem;
|
46
|
+
color: var(--lesli-color-primary, lesli-css-color(blue));
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
form.information {
|
51
|
+
max-width: 80%;
|
52
|
+
}
|
53
|
+
|
54
|
+
// · roles management cards
|
55
|
+
.roles-types {
|
56
|
+
display: grid;
|
57
|
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
58
|
+
grid-auto-rows: minmax(198px, auto);
|
59
|
+
gap: 20px;
|
60
|
+
|
61
|
+
&-item {
|
62
|
+
width: 100%;
|
63
|
+
height: 135px;
|
64
|
+
border-radius: 8px;
|
65
|
+
margin: 5px;
|
66
|
+
}
|
67
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
32
|
+
namespace :lesli_security do
|
33
|
+
|
34
|
+
desc "Syncing privileges for all the available roles"
|
35
|
+
task :privileges => :environment do |task, args|
|
36
|
+
role_sync_privileges()
|
37
|
+
end
|
38
|
+
|
39
|
+
# Drop, build, migrate & seed database (development only)
|
40
|
+
def role_sync_privileges
|
41
|
+
|
42
|
+
Lesli::Descriptor.where(:name => ["owner", "sysadmin"]).each do |descriptor|
|
43
|
+
descriptor.initialize_descriptor_privileges
|
44
|
+
end
|
45
|
+
|
46
|
+
Lesli::RoleDescriptorOperator.new(Lesli::Role.all.pluck(:id)).synchronize
|
47
|
+
|
48
|
+
L2.msg("LesliSecurity: Syncing privileges for all the available roles")
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
/*
|
2
|
+
Lesli
|
3
|
+
|
4
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
5
|
+
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU General Public License
|
17
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
18
|
+
|
19
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
20
|
+
|
21
|
+
Made with ♥ by https://www.lesli.tech
|
22
|
+
Building a better future, one line of code at a time.
|
23
|
+
|
24
|
+
@contact hello@lesli.tech
|
25
|
+
@website https://www.lesli.tech
|
26
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
27
|
+
|
28
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
29
|
+
// ·
|
30
|
+
*/
|
31
|
+
|
32
|
+
|
33
|
+
// · Import Lesli builders
|
34
|
+
import application from "Lesli/vue/application"
|
35
|
+
import translation from "Lesli/vue/translation"
|
36
|
+
|
37
|
+
|
38
|
+
// · Import engine translations
|
39
|
+
import translations from "LesliSecurity/vue/stores/translations.json"
|
40
|
+
|
41
|
+
|
42
|
+
// ·
|
43
|
+
import applicationUserIndex from "LesliSecurity/vue/apps/users/index.vue"
|
44
|
+
import applicationUserShow from "LesliSecurity/vue/apps/users/show.vue"
|
45
|
+
|
46
|
+
import appRoleNew from "LesliSecurity/vue/apps/roles/new.vue"
|
47
|
+
import appRoleShow from "LesliSecurity/vue/apps/roles/show.vue"
|
48
|
+
import appRoleEdit from "LesliSecurity/vue/apps/roles/edit.vue"
|
49
|
+
import appRoleIndex from "LesliSecurity/vue/apps/roles/index.vue"
|
50
|
+
|
51
|
+
import appDescriptorIndex from "LesliSecurity/vue/apps/descriptors/index.vue"
|
52
|
+
import appDescriptorNew from "LesliSecurity/vue/apps/descriptors/new.vue"
|
53
|
+
import appDescriptorShow from "LesliSecurity/vue/apps/descriptors/show.vue"
|
54
|
+
|
55
|
+
|
56
|
+
// ·
|
57
|
+
import appDashboardShow from "Lesli/vue/shared/dashboards/apps/show.vue"
|
58
|
+
import appDashboardEdit from "Lesli/vue/shared/dashboards/apps/edit.vue"
|
59
|
+
|
60
|
+
|
61
|
+
// ·
|
62
|
+
const dashboardProps = {
|
63
|
+
components: {
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
// · Buil Lesli translations
|
69
|
+
translation(translations)
|
70
|
+
|
71
|
+
|
72
|
+
// ·
|
73
|
+
application("LesliSecurity", [{
|
74
|
+
path: "/",
|
75
|
+
component: appDashboardShow,
|
76
|
+
props: dashboardProps
|
77
|
+
}, {
|
78
|
+
path: "/dashboard",
|
79
|
+
component: appDashboardShow,
|
80
|
+
props: dashboardProps
|
81
|
+
}, {
|
82
|
+
path: "/dashboards/:id/edit",
|
83
|
+
component: appDashboardEdit,
|
84
|
+
props: dashboardProps
|
85
|
+
}, {
|
86
|
+
path: "/users",
|
87
|
+
component: applicationUserIndex
|
88
|
+
}, {
|
89
|
+
path: "/users/:id",
|
90
|
+
component: applicationUserShow
|
91
|
+
}, {
|
92
|
+
path: "/roles",
|
93
|
+
component: appRoleIndex
|
94
|
+
}, {
|
95
|
+
path: "/roles/new",
|
96
|
+
component: appRoleNew
|
97
|
+
}, {
|
98
|
+
path: "/roles/:id",
|
99
|
+
component: appRoleShow
|
100
|
+
}, {
|
101
|
+
path: "/roles/:id/edit",
|
102
|
+
component: appRoleEdit
|
103
|
+
}, {
|
104
|
+
path: "/descriptors",
|
105
|
+
component: appDescriptorIndex
|
106
|
+
}, {
|
107
|
+
path: "/descriptors/new",
|
108
|
+
component: appDescriptorNew
|
109
|
+
}, {
|
110
|
+
path: "/descriptors/:id",
|
111
|
+
component: appDescriptorShow
|
112
|
+
}])
|
@@ -0,0 +1,136 @@
|
|
1
|
+
<script setup>
|
2
|
+
/*
|
3
|
+
|
4
|
+
Lesli
|
5
|
+
|
6
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
7
|
+
|
8
|
+
This program is free software: you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Public License as published by
|
10
|
+
the Free Software Foundation, either version 3 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License
|
19
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
20
|
+
|
21
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
22
|
+
|
23
|
+
Made with ♥ by https://www.lesli.tech
|
24
|
+
Building a better future, one line of code at a time.
|
25
|
+
|
26
|
+
@contact hello@lesli.tech
|
27
|
+
@website https://www.lesli.tech
|
28
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
29
|
+
|
30
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
31
|
+
// ·
|
32
|
+
*/
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
// · import vue tools
|
37
|
+
import { inject, onMounted } from "vue"
|
38
|
+
|
39
|
+
|
40
|
+
// · import vue router composable
|
41
|
+
import { useRouter, useRoute } from "vue-router"
|
42
|
+
|
43
|
+
|
44
|
+
// · import lesli stores
|
45
|
+
import { useDescriptor } from "LesliSecurity/vue/stores/descriptor"
|
46
|
+
|
47
|
+
|
48
|
+
// · implement stores
|
49
|
+
const storeDescriptor = useDescriptor()
|
50
|
+
|
51
|
+
|
52
|
+
// · initialize/inject plugins
|
53
|
+
const router = useRouter()
|
54
|
+
const url = inject("url")
|
55
|
+
const route = useRoute()
|
56
|
+
|
57
|
+
|
58
|
+
// · defining props
|
59
|
+
const props = defineProps({
|
60
|
+
isEditable: {
|
61
|
+
type: Boolean,
|
62
|
+
required: false,
|
63
|
+
default: false,
|
64
|
+
},
|
65
|
+
})
|
66
|
+
|
67
|
+
|
68
|
+
// · translations
|
69
|
+
const translations = {
|
70
|
+
core: {
|
71
|
+
roles: I18n.t("core.roles"),
|
72
|
+
shared: I18n.t("core.shared"),
|
73
|
+
role_descriptors: I18n.t('core.role_descriptors')
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
function onUpdate() {
|
78
|
+
storeDescriptor.updateDescriptor()
|
79
|
+
}
|
80
|
+
|
81
|
+
function onCreate() {
|
82
|
+
storeDescriptor.postDescriptor()
|
83
|
+
}
|
84
|
+
|
85
|
+
onMounted(() => {
|
86
|
+
if (!props.isEditable){
|
87
|
+
storeDescriptor.resetDescriptor()
|
88
|
+
} else {
|
89
|
+
storeDescriptor.fetchDescriptor(route.params?.id)
|
90
|
+
}
|
91
|
+
})
|
92
|
+
|
93
|
+
</script>
|
94
|
+
<template>
|
95
|
+
<lesli-form @submit="isEditable ? onUpdate() : onCreate()">
|
96
|
+
|
97
|
+
<div class="field">
|
98
|
+
<label class="label">
|
99
|
+
{{ translations.core.view_text_name }}
|
100
|
+
<sup class="has-text-danger">*</sup>
|
101
|
+
</label>
|
102
|
+
<div class="control">
|
103
|
+
<input name="name" v-model="storeDescriptor.descriptor.payload.name" required="required" type="text" class="input">
|
104
|
+
</div>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div class="field">
|
108
|
+
<label class="label">
|
109
|
+
{{ translations.core.role_descriptors.view_text_assign_parent_descriptor }}
|
110
|
+
</label>
|
111
|
+
<div class="control">
|
112
|
+
<lesli-select
|
113
|
+
v-model="storeDescriptor.descriptor.payload.descriptors_id"
|
114
|
+
:options="storeDescriptor.descriptors_options">
|
115
|
+
</lesli-select>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div class="field">
|
120
|
+
<label class="label">
|
121
|
+
{{ translations.core.role_descriptors.column_description }}
|
122
|
+
</label>
|
123
|
+
<div class="control">
|
124
|
+
<textarea class="textarea" v-model="storeDescriptor.descriptor.payload.description"></textarea>
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
|
128
|
+
<div class="field">
|
129
|
+
<div class="control">
|
130
|
+
<lesli-button icon="save">
|
131
|
+
{{ translations.core.shared.view_btn_save }}
|
132
|
+
</lesli-button>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
</lesli-form>
|
136
|
+
</template>
|