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
data/config/routes.rb
ADDED
@@ -0,0 +1,90 @@
|
|
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
|
+
LesliSecurity::Engine.routes.draw do
|
34
|
+
|
35
|
+
# Dashboard alias
|
36
|
+
root to: "dashboards#show"
|
37
|
+
|
38
|
+
# Dashboard management
|
39
|
+
resource :dashboard, only: [:show]
|
40
|
+
resources :dashboards do
|
41
|
+
collection do
|
42
|
+
post "list" => :index
|
43
|
+
get :options
|
44
|
+
end
|
45
|
+
scope module: :dashboard do
|
46
|
+
resources :components
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# User management
|
51
|
+
resources :users, only: [:index, :show, :new, :update] do
|
52
|
+
|
53
|
+
# extensions to the user methods
|
54
|
+
scope module: :user do
|
55
|
+
|
56
|
+
# sessions management
|
57
|
+
resources :sessions, only: [:index, :destroy]
|
58
|
+
|
59
|
+
# assign and remove roles to users
|
60
|
+
resources :roles, only: [:index, :create, :destroy]
|
61
|
+
|
62
|
+
# shortcuts
|
63
|
+
resources :shortcuts, only: [:index, :create, :update, :destroy]
|
64
|
+
|
65
|
+
# configuration
|
66
|
+
resources :settings, only: [:create]
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Work with roles and privileges
|
72
|
+
resources :roles, only: [:index, :show, :edit, :new, :create] do
|
73
|
+
scope module: :role do
|
74
|
+
resources :descriptors, only: [:index, :create, :update, :destroy]
|
75
|
+
resources :privileges, only: [:index]
|
76
|
+
resources :activities
|
77
|
+
end
|
78
|
+
collection do
|
79
|
+
get :options
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Descriptor management
|
84
|
+
resources :descriptors, only: [:index, :show, :new, :create] do
|
85
|
+
scope module: :descriptor do
|
86
|
+
resources :privileges, only: [:index, :create, :destroy]
|
87
|
+
#resources :activities
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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 CreateLesliRoles < ActiveRecord::Migration[7.0]
|
34
|
+
def change
|
35
|
+
|
36
|
+
create_table :lesli_roles do |t|
|
37
|
+
t.string :name
|
38
|
+
t.string :code
|
39
|
+
t.string :description
|
40
|
+
t.boolean :active
|
41
|
+
|
42
|
+
# redirect users to path after login
|
43
|
+
t.string :path_default
|
44
|
+
|
45
|
+
# allow users to access resources only inside the :path_default
|
46
|
+
t.boolean :path_limited
|
47
|
+
|
48
|
+
# allow users to work only with data created or assigned to them
|
49
|
+
t.boolean :isolated, default: false
|
50
|
+
|
51
|
+
# role hierarchy
|
52
|
+
t.integer :object_level_permission, default: 10
|
53
|
+
|
54
|
+
t.datetime :deleted_at, index: true
|
55
|
+
t.timestamps
|
56
|
+
end
|
57
|
+
|
58
|
+
add_reference(:lesli_roles, :account, foreign_key: { to_table: :lesli_accounts })
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,97 @@
|
|
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 platform.
|
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 CreateLesliUsers < ActiveRecord::Migration[5.2]
|
34
|
+
def change
|
35
|
+
create_table :lesli_users do |t|
|
36
|
+
# Hard-lock strategy
|
37
|
+
t.boolean :active, default: true, null: false
|
38
|
+
|
39
|
+
# authenticatable
|
40
|
+
t.string :email, null: false, default: ""
|
41
|
+
t.string :encrypted_password, null: false, default: ""
|
42
|
+
|
43
|
+
# Customizable
|
44
|
+
t.string :alias
|
45
|
+
t.string :salutation
|
46
|
+
t.string :first_name
|
47
|
+
t.string :last_name
|
48
|
+
|
49
|
+
# Recoverable
|
50
|
+
t.string :reset_password_token
|
51
|
+
t.datetime :reset_password_sent_at
|
52
|
+
|
53
|
+
# Password and access management
|
54
|
+
t.datetime :password_expiration_at
|
55
|
+
t.datetime :locked_until
|
56
|
+
|
57
|
+
# Rememberable
|
58
|
+
t.datetime :remember_created_at
|
59
|
+
|
60
|
+
# Trackable
|
61
|
+
t.integer :sign_in_count, default: 0, null: false
|
62
|
+
t.datetime :current_sign_in_at
|
63
|
+
t.datetime :last_sign_in_at
|
64
|
+
t.inet :current_sign_in_ip
|
65
|
+
t.inet :last_sign_in_ip
|
66
|
+
|
67
|
+
# Confirmable
|
68
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
69
|
+
t.string :confirmation_token
|
70
|
+
t.datetime :confirmation_sent_at
|
71
|
+
t.datetime :confirmed_at
|
72
|
+
|
73
|
+
# Telephone confirmation (custom)
|
74
|
+
t.string :telephone
|
75
|
+
t.string :telephone_confirmation_token
|
76
|
+
t.datetime :telephone_confirmation_sent_at
|
77
|
+
t.datetime :telephone_confirmed_at
|
78
|
+
|
79
|
+
# Lockable
|
80
|
+
t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
81
|
+
t.string :unlock_token # Only if unlock strategy is :email or :both
|
82
|
+
t.datetime :locked_at
|
83
|
+
|
84
|
+
# Acts as paranoid
|
85
|
+
t.datetime :deleted_at, index: true
|
86
|
+
t.timestamps
|
87
|
+
end
|
88
|
+
|
89
|
+
add_reference(:lesli_users, :account, foreign_key: { to_table: :lesli_accounts })
|
90
|
+
add_reference(:lesli_accounts, :user, foreign_key: { to_table: :lesli_users })
|
91
|
+
|
92
|
+
add_index(:lesli_users, :email, unique: true)
|
93
|
+
add_index(:lesli_users, :unlock_token, unique: true)
|
94
|
+
add_index(:lesli_users, :confirmation_token, unique: true)
|
95
|
+
add_index(:lesli_users, :reset_password_token, unique: true)
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,49 @@
|
|
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 CreateLesliUserDetails < ActiveRecord::Migration[6.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_user_details do |t|
|
36
|
+
t.string :title
|
37
|
+
t.string :address
|
38
|
+
|
39
|
+
t.bigint :work_city
|
40
|
+
t.bigint :work_region
|
41
|
+
t.bigint :work_address
|
42
|
+
|
43
|
+
t.datetime :deleted_at, index: true
|
44
|
+
t.timestamps
|
45
|
+
end
|
46
|
+
add_reference(:lesli_user_details, :user, foreign_key: { to_table: :lesli_users })
|
47
|
+
#add_reference(:lesli_user_details, :account_location, foreign_key: { to_table: :account_locations })
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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 Development Platform.
|
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 CreateLesliUserSettings < ActiveRecord::Migration[6.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_user_settings do |t|
|
36
|
+
t.string :name
|
37
|
+
t.string :value
|
38
|
+
t.timestamps
|
39
|
+
end
|
40
|
+
|
41
|
+
add_reference(:lesli_user_settings, :user, foreign_key: { to_table: :lesli_users })
|
42
|
+
add_index(:lesli_user_settings, %i[user_id name], unique: true)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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 Development Platform.
|
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 CreateLesliUserSessions < ActiveRecord::Migration[6.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_user_sessions do |t|
|
36
|
+
t.inet :remote # IPv4 and IPv6 hosts and networks
|
37
|
+
|
38
|
+
t.string :agent_platform
|
39
|
+
t.string :agent_os
|
40
|
+
t.string :agent_browser
|
41
|
+
t.string :agent_version
|
42
|
+
|
43
|
+
t.string :session_token # authentication token
|
44
|
+
t.string :session_source # session created for/with
|
45
|
+
|
46
|
+
t.integer :usage_count # total number of interactions
|
47
|
+
t.datetime :last_used_at # last datetime token was used
|
48
|
+
t.datetime :expiration_at, index: true # auto-expire session at
|
49
|
+
t.datetime :deleted_at, index: true
|
50
|
+
|
51
|
+
t.timestamps
|
52
|
+
end
|
53
|
+
add_reference(:lesli_user_sessions, :user, foreign_key: { to_table: :lesli_users })
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,43 @@
|
|
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 Development Platform.
|
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 CreateLesliUserPowers < ActiveRecord::Migration[6.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_user_powers do |t|
|
36
|
+
t.datetime :deleted_at, index: true
|
37
|
+
t.timestamps
|
38
|
+
end
|
39
|
+
|
40
|
+
add_reference(:lesli_user_powers, :user, foreign_key: { to_table: :lesli_users })
|
41
|
+
add_reference(:lesli_user_powers, :role, foreign_key: { to_table: :lesli_roles })
|
42
|
+
end
|
43
|
+
end
|
@@ -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 CreateLesliUserLogs < ActiveRecord::Migration[6.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_user_logs do |t|
|
36
|
+
t.string :title
|
37
|
+
t.string :description
|
38
|
+
|
39
|
+
t.timestamps
|
40
|
+
end
|
41
|
+
|
42
|
+
add_reference(:lesli_user_logs, :user, foreign_key: { to_table: :lesli_users })
|
43
|
+
add_reference(:lesli_user_logs, :session, foreign_key: { to_table: :lesli_user_sessions })
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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 CreateLesliDescriptors < ActiveRecord::Migration[7.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_descriptors do |t|
|
36
|
+
t.string :name
|
37
|
+
t.string :description
|
38
|
+
t.datetime :deleted_at, index: true
|
39
|
+
t.timestamps
|
40
|
+
end
|
41
|
+
|
42
|
+
add_reference(:lesli_descriptors, :account, foreign_key: { to_table: :lesli_accounts })
|
43
|
+
end
|
44
|
+
end
|
@@ -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 CreateLesliDescriptorPrivileges < ActiveRecord::Migration[7.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_descriptor_privileges do |t|
|
36
|
+
t.datetime :deleted_at, index: true
|
37
|
+
t.timestamps
|
38
|
+
end
|
39
|
+
|
40
|
+
add_reference(:lesli_descriptor_privileges, :descriptor, foreign_key: { to_table: :lesli_descriptors })
|
41
|
+
add_reference(:lesli_descriptor_privileges, :action,
|
42
|
+
foreign_key: { to_table: :lesli_system_controller_actions },
|
43
|
+
index: { name: "descriptor_privileges_controller_actions" })
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,49 @@
|
|
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 CreateLesliDescriptorActivities < ActiveRecord::Migration[7.0]
|
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", "00000004_activities.json")))
|
37
|
+
|
38
|
+
create_table :lesli_descriptor_activities do |t|
|
39
|
+
table_base_structure.each do |column|
|
40
|
+
t.send(
|
41
|
+
column["type"].parameterize.underscore.to_sym,
|
42
|
+
column["name"].parameterize.underscore.to_sym
|
43
|
+
)
|
44
|
+
end
|
45
|
+
t.timestamps
|
46
|
+
end
|
47
|
+
add_reference(:lesli_descriptor_activities, :descriptor, foreign_key: { to_table: :lesli_descriptors })
|
48
|
+
end
|
49
|
+
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 CreateLesliRolePowers < ActiveRecord::Migration[7.0]
|
34
|
+
def change
|
35
|
+
create_table :lesli_role_powers do |t|
|
36
|
+
t.boolean :plist # enables all the index privileges in the descriptor
|
37
|
+
t.boolean :pindex # enables all the index privileges in the descriptor
|
38
|
+
t.boolean :pshow # enables all the show privileges in the descriptor
|
39
|
+
t.boolean :pcreate # enables all the create privileges in the descriptor
|
40
|
+
t.boolean :pupdate # enables all the update privileges in the descriptor
|
41
|
+
t.boolean :pdestroy # enables all the destroy privileges in the descriptor
|
42
|
+
|
43
|
+
t.datetime :deleted_at, index: true
|
44
|
+
t.timestamps
|
45
|
+
end
|
46
|
+
|
47
|
+
add_reference(:lesli_role_powers, :user, foreign_key: { to_table: :lesli_users })
|
48
|
+
add_reference(:lesli_role_powers, :role, foreign_key: { to_table: :lesli_roles })
|
49
|
+
add_reference(:lesli_role_powers, :descriptor, foreign_key: { to_table: :lesli_descriptors })
|
50
|
+
end
|
51
|
+
end
|