lato_core 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +0 -12
- data/app/controllers/lato_core/api/v1/api_controller.rb +2 -3
- data/app/controllers/lato_core/application_controller.rb +1 -1
- data/app/controllers/lato_core/back/authentication_controller.rb +12 -11
- data/app/controllers/lato_core/back/back_controller.rb +13 -19
- data/app/controllers/lato_core/back/superusers_controller.rb +123 -148
- data/app/mailers/lato_core/application_mailer.rb +3 -4
- data/app/mailers/lato_core/superusers_mailer.rb +5 -7
- data/app/models/lato_core/superuser.rb +27 -19
- data/app/views/lato_core/back/authentication/login.html.erb +12 -9
- data/app/views/lato_core/back/authentication/password_edit.html.erb +9 -14
- data/app/views/lato_core/back/authentication/password_forget.html.erb +26 -27
- data/app/views/lato_core/back/back/home.html.erb +5 -5
- data/app/views/lato_core/back/superusers/edit.html.erb +12 -3
- data/app/views/lato_core/back/superusers/index.html.erb +23 -13
- data/app/views/lato_core/back/superusers/new.html.erb +12 -3
- data/app/views/lato_core/back/superusers/shared/_form.html.erb +3 -6
- data/config/config.yml +1 -1
- data/config/example.yml +3 -3
- data/config/initializers/init.rb +4 -5
- data/{test/dummy/log/test.log → config/initializers/lists.rb} +0 -0
- data/config/initializers/ram.rb +1 -37
- data/config/routes.rb +4 -5
- data/lib/lato_core.rb +2 -6
- data/lib/lato_core/engine.rb +6 -6
- data/lib/lato_core/interface.rb +12 -15
- data/lib/lato_core/interface/authentication.rb +19 -27
- data/lib/lato_core/interface/cache.rb +17 -23
- data/lib/lato_core/interface/communication.rb +68 -85
- data/lib/lato_core/interface/languages.rb +38 -47
- data/lib/lato_core/interface/navigation.rb +79 -93
- data/lib/lato_core/interface/session.rb +47 -61
- data/lib/lato_core/interface/superusers.rb +113 -122
- data/lib/tasks/lato_core_tasks.rake +2 -5
- metadata +4 -99
- data/test/controllers/lato_core/api/v1/api_controller_test.rb +0 -9
- data/test/controllers/lato_core/application_controller_test.rb +0 -9
- data/test/controllers/lato_core/back/authentication_controller_test.rb +0 -13
- data/test/controllers/lato_core/back/back_controller_test.rb +0 -9
- data/test/controllers/lato_core/back/session_controller_test.rb +0 -13
- data/test/controllers/lato_core/back/superusers_controller_test.rb +0 -13
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -29
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -25
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -41
- data/test/dummy/config/environments/production.rb +0 -79
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/assets.rb +0 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/lato_core/superusers.yml +0 -11
- data/test/integration/navigation_test.rb +0 -8
- data/test/lato_core_test.rb +0 -7
- data/test/mailers/lato_core/lato_core_mailer_test.rb +0 -9
- data/test/mailers/previews/lato_core/lato_core_mailer_preview.rb +0 -6
- data/test/models/lato_core/superuser_test.rb +0 -9
- data/test/test_helper.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d4f8962583791bb07d2c7cf84bbdb2b4bdd8748
|
4
|
+
data.tar.gz: 4f3797dabf9b2cc4c116da0a15aa068d0a2fd10e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4404c8c4c8a215f6998a62e0ca797ea0576b07cc639241ba3831b29ddacf16388990670eeb482353750c06760677c61a5e52667bceda0187614434fb21e3926e
|
7
|
+
data.tar.gz: b8baa9eb218ed86f43755091beeef61d970ccbd9a920fbb090d84b260eebb179bfe4302330e36cb87ac81bbc63a1d0dbc24004cbc76c97ace3d2760877cb5b0f
|
data/Rakefile
CHANGED
@@ -4,17 +4,6 @@ rescue LoadError
|
|
4
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
5
|
end
|
6
6
|
|
7
|
-
require 'rdoc/task'
|
8
|
-
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = 'doc'
|
11
|
-
rdoc.title = 'LatoCore'
|
12
|
-
rdoc.rdoc_files.include('README.md')
|
13
|
-
rdoc.rdoc_files.include('lib/lato_core.rb')
|
14
|
-
rdoc.rdoc_files.include('lib/lato_core/**/*.rb')
|
15
|
-
rdoc.rdoc_files.include('app/models/**/*.rb')
|
16
|
-
end
|
17
|
-
|
18
7
|
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
19
8
|
load 'rails/tasks/engine.rake'
|
20
9
|
|
@@ -22,7 +11,6 @@ load 'rails/tasks/engine.rake'
|
|
22
11
|
load 'rails/tasks/statistics.rake'
|
23
12
|
|
24
13
|
|
25
|
-
|
26
14
|
Bundler::GemHelper.install_tasks
|
27
15
|
|
28
16
|
require 'rake/testtask'
|
@@ -1,18 +1,17 @@
|
|
1
1
|
module LatoCore
|
2
2
|
module Back
|
3
|
-
#
|
3
|
+
# This class is used for authentication actions.
|
4
4
|
class AuthenticationController < Back::BackController
|
5
5
|
|
6
|
-
#
|
6
|
+
# not use login check for actions on this controller.
|
7
7
|
skip_before_action :core_controlUser, except: [:exec_logout]
|
8
8
|
|
9
|
-
#
|
9
|
+
# This function render login view if user is not logged.
|
10
10
|
def login
|
11
11
|
redirect_to lato_core.root_path if core_controlSession
|
12
12
|
end
|
13
13
|
|
14
|
-
#
|
15
|
-
# alla homepage del backoffice
|
14
|
+
# This function exec the login for user using username and password.
|
16
15
|
def exec_login
|
17
16
|
if core_createSession(params[:username], params[:password])
|
18
17
|
redirect_to lato_core.root_path
|
@@ -22,20 +21,21 @@ module LatoCore
|
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
25
|
-
#
|
24
|
+
# This function exec the logout for user and redirect it to login page.
|
26
25
|
def exec_logout
|
27
26
|
core_destroySession
|
28
27
|
redirect_to lato_core.login_path
|
29
28
|
end
|
30
29
|
|
31
|
-
#
|
32
|
-
#
|
30
|
+
# This function render the password forget view if user active this
|
31
|
+
# action on config file.
|
33
32
|
def password_forget
|
34
33
|
redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission
|
35
34
|
redirect_to lato_core.root_path if core_controlSession
|
36
35
|
end
|
37
36
|
|
38
|
-
#
|
37
|
+
# This function exec the recover password action and send the email to
|
38
|
+
# user for new password.
|
39
39
|
def password_recover
|
40
40
|
redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission
|
41
41
|
if user = LatoCore::Superuser.find_by(email: params[:email].downcase)
|
@@ -54,7 +54,8 @@ module LatoCore
|
|
54
54
|
redirect_to lato_core.login_path
|
55
55
|
end
|
56
56
|
|
57
|
-
#
|
57
|
+
# This function render the edit view for user who ask to recover
|
58
|
+
# its password (and check if it can do this action).
|
58
59
|
def password_edit
|
59
60
|
redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission
|
60
61
|
redirect_to lato_core.root_path if core_controlSession
|
@@ -91,7 +92,7 @@ module LatoCore
|
|
91
92
|
@user.update_attribute(:session_code, new_code)
|
92
93
|
end
|
93
94
|
|
94
|
-
#
|
95
|
+
# This function ecec the password update after the recovery request.
|
95
96
|
def password_update
|
96
97
|
redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission
|
97
98
|
user = LatoCore::Superuser.find(params[:id])
|
@@ -1,27 +1,21 @@
|
|
1
|
-
# Includo l'interfaccia di lato_core
|
2
|
-
include LatoCore::Interface
|
3
|
-
# Includo l'interfaccia di lato_view
|
4
|
-
include LatoView::Interface
|
5
|
-
|
6
1
|
module LatoCore
|
7
|
-
|
8
|
-
|
9
|
-
class BackController < ApplicationController
|
2
|
+
# This class is the main class for the lato backend panel.
|
3
|
+
class Back::BackController < ApplicationController
|
10
4
|
|
11
|
-
|
12
|
-
|
5
|
+
# set default lato_view layout
|
6
|
+
layout 'lato_layout'
|
13
7
|
|
14
|
-
|
15
|
-
|
8
|
+
# set check login control for every actions.
|
9
|
+
before_action :core_controlUser
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
11
|
+
# This function render the default home view for lato after login or
|
12
|
+
# redirect to custom url if config file set one.
|
13
|
+
def home
|
14
|
+
# rimando ad una pagina custom se è stato impostato da file di
|
15
|
+
# configurazione
|
16
|
+
if login_root = core_getApplicationLoginRoot and login_root
|
17
|
+
redirect_to login_root
|
23
18
|
end
|
24
|
-
|
25
19
|
end
|
26
20
|
|
27
21
|
end
|
@@ -1,171 +1,146 @@
|
|
1
1
|
module LatoCore
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
class Back::SuperusersController < Back::BackController
|
3
|
+
|
4
|
+
# before actions
|
5
|
+
before_action do
|
6
|
+
# set menu voice active
|
7
|
+
view_setCurrentVoice('core_superusers')
|
8
|
+
# check minimum permission value to 6
|
9
|
+
redirect_to lato_core.root_path unless core_controlPermission(6)
|
10
|
+
end
|
5
11
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
before_action :control_permission
|
12
|
+
def new
|
13
|
+
@superuser = LatoCore::Superuser.new
|
14
|
+
end
|
10
15
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
def create
|
17
|
+
superuser = LatoCore::Superuser.new(superuser_params)
|
18
|
+
# controllo che l'utente creato non abbia permessi superiori dell'utente
|
19
|
+
# creatore
|
20
|
+
if superuser.permission > core_getCurrentUser.permission
|
21
|
+
flash[:warning] = CORE_LANG['superusers']['permission_create']
|
22
|
+
redirect_to lato_core.superusers_path and return false
|
23
|
+
end
|
24
|
+
# controllo che la creazione dell'utente non abbia avuto errori
|
25
|
+
unless superuser.save
|
26
|
+
flash[:danger] = CORE_LANG['superusers']['failed_create']
|
27
|
+
redirect_to lato_core.superusers_path and return false
|
15
28
|
end
|
16
29
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
def create
|
21
|
-
superuser = LatoCore::Superuser.new(superuser_params)
|
22
|
-
# controllo che l'utente creato non abbia permessi superiori dell'utente
|
23
|
-
# creatore
|
24
|
-
if superuser.permission > core_getCurrentUser.permission
|
25
|
-
flash[:warning] = CORE_LANG['superusers']['permission_create']
|
26
|
-
redirect_to lato_core.superusers_path and return false
|
27
|
-
end
|
28
|
-
# controllo che la creazione dell'utente non abbia avuto errori
|
29
|
-
unless superuser.save
|
30
|
-
flash[:danger] = CORE_LANG['superusers']['failed_create']
|
31
|
-
redirect_to lato_core.superusers_path and return false
|
32
|
-
end
|
30
|
+
flash[:success] = CORE_LANG['superusers']['success_create']
|
31
|
+
redirect_to lato_core.superuser_path(superuser)
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
def edit
|
35
|
+
@superuser = LatoCore::Superuser.find(params[:id])
|
36
|
+
# controllo che l'utente da modificare esista
|
37
|
+
unless @superuser
|
38
|
+
flash[:warning] = CORE_LANG['superusers']['not_found']
|
39
|
+
redirect_to lato_core.superusers_path and return false
|
36
40
|
end
|
37
|
-
|
38
|
-
#
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
unless @superuser
|
44
|
-
flash[:warning] = CORE_LANG['superusers']['not_found']
|
45
|
-
redirect_to lato_core.superusers_path and return false
|
46
|
-
end
|
47
|
-
# controllo che l'utente da modificare non abbia permessi uguali o
|
48
|
-
# maggiori dell'utente modificatore
|
49
|
-
if @superuser.permission >= core_getCurrentUser.permission &&
|
50
|
-
@superuser.permission != core_getCurrentUser.permission
|
51
|
-
flash[:warning] = CORE_LANG['superusers']['permission_update']
|
52
|
-
redirect_to lato_core.superusers_path and return false
|
53
|
-
end
|
41
|
+
# controllo che l'utente da modificare non abbia permessi uguali o
|
42
|
+
# maggiori dell'utente modificatore
|
43
|
+
if @superuser.permission >= core_getCurrentUser.permission &&
|
44
|
+
@superuser.permission != core_getCurrentUser.permission
|
45
|
+
flash[:warning] = CORE_LANG['superusers']['permission_update']
|
46
|
+
redirect_to lato_core.superusers_path and return false
|
54
47
|
end
|
48
|
+
end
|
55
49
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
redirect_to lato_core.superuser_path(superuser) and return false
|
88
|
-
end
|
89
|
-
|
90
|
-
flash[:success] = CORE_LANG['superusers']['success_update']
|
91
|
-
redirect_to lato_core.superuser_path(superuser)
|
50
|
+
def update
|
51
|
+
superuser = LatoCore::Superuser.find(params[:id])
|
52
|
+
# controllo che l'utente da modificare esista
|
53
|
+
unless superuser
|
54
|
+
flash[:warning] = CORE_LANG['superusers']['not_found']
|
55
|
+
redirect_to lato_core.superusers_path and return false
|
56
|
+
end
|
57
|
+
# controllo che l'utente da modificare non abbia permessi uguali o
|
58
|
+
# maggiori dell'utente modificatore
|
59
|
+
if superuser.permission >= core_getCurrentUser.permission &&
|
60
|
+
superuser != core_getCurrentUser
|
61
|
+
flash[:warning] = CORE_LANG['superusers']['permission_update']
|
62
|
+
redirect_to lato_core.superusers_path and return false
|
63
|
+
end
|
64
|
+
# controllo che l'utente non si stia auto aumentando i permessi
|
65
|
+
if superuser.id === core_getCurrentUser.id &&
|
66
|
+
superuser.permission < params[:superuser][:permission].to_i
|
67
|
+
flash[:warning] = CORE_LANG['superusers']['level_update']
|
68
|
+
redirect_to lato_core.superusers_path and return false
|
69
|
+
end
|
70
|
+
# faccio in modo che l'aggiornamento avvenga senza problemi anche se
|
71
|
+
# la password non e' stata inserita
|
72
|
+
if params[:superuser][:password].blank? &&
|
73
|
+
params[:superuser][:password_confirmation].blank?
|
74
|
+
params[:superuser].delete(:password)
|
75
|
+
params[:superuser].delete(:password_confirmation)
|
76
|
+
end
|
77
|
+
# controllo che non ci siano stati errori di aggiornamento
|
78
|
+
unless superuser.update(superuser_params)
|
79
|
+
flash[:danger] = CORE_LANG['superusers']['failed_update']
|
80
|
+
redirect_to lato_core.superuser_path(superuser) and return false
|
92
81
|
end
|
93
82
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
# controllo che l'utente da eliminare esista
|
98
|
-
unless superuser
|
99
|
-
flash[:warning] = CORE_LANG['superusers']['not_found']
|
100
|
-
redirect_to lato_core.superusers_path and return false
|
101
|
-
end
|
102
|
-
# controllo che l'utente non stia provando a eliminare se stesso
|
103
|
-
if superuser === core_getCurrentUser
|
104
|
-
flash[:warning] = CORE_LANG['superusers']['itself_destroy']
|
105
|
-
redirect_to lato_core.superusers_path and return false
|
106
|
-
end
|
107
|
-
# controllo che l'utente da eliminare non abbia permessi maggiori o
|
108
|
-
# uguali all'utente eliminatore
|
109
|
-
if superuser.permission >= core_getCurrentUser.permission
|
110
|
-
flash[:warning] = CORE_LANG['superusers']['permission_destroy']
|
111
|
-
redirect_to lato_core.superusers_path and return false
|
112
|
-
end
|
113
|
-
# controllo che non ci siano stati errori durante l'eliminazione
|
114
|
-
unless superuser.destroy
|
115
|
-
flash[:danger] = CORE_LANG['superusers']['failed_destroy']
|
116
|
-
redirect_to lato_core.superuser_path(superuser) and return false
|
117
|
-
end
|
83
|
+
flash[:success] = CORE_LANG['superusers']['success_update']
|
84
|
+
redirect_to lato_core.superuser_path(superuser)
|
85
|
+
end
|
118
86
|
|
119
|
-
|
120
|
-
|
87
|
+
def destroy
|
88
|
+
superuser = LatoCore::Superuser.find(params[:id])
|
89
|
+
# controllo che l'utente da eliminare esista
|
90
|
+
unless superuser
|
91
|
+
flash[:warning] = CORE_LANG['superusers']['not_found']
|
92
|
+
redirect_to lato_core.superusers_path and return false
|
121
93
|
end
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
@superuser = LatoCore::Superuser.find(params[:id])
|
127
|
-
# controllo che l'utente da mostrare sia esistente
|
128
|
-
redirect_to lato_core.superusers_path unless @superuser
|
94
|
+
# controllo che l'utente non stia provando a eliminare se stesso
|
95
|
+
if superuser === core_getCurrentUser
|
96
|
+
flash[:warning] = CORE_LANG['superusers']['itself_destroy']
|
97
|
+
redirect_to lato_core.superusers_path and return false
|
129
98
|
end
|
130
|
-
|
131
|
-
#
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
# controllo che non vengano mostrati gli utenti impostati nascosti
|
136
|
-
hide_settings = core_getHideUsersSettings
|
137
|
-
if hide_settings && !hide_settings.blank?
|
138
|
-
permissions_not_accepted = []
|
139
|
-
current_user_permission = core_getCurrentUser.permission
|
140
|
-
hide_settings.each do |setting|
|
141
|
-
permissions_not_accepted.push(setting.first) if setting.last.to_i === current_user_permission
|
142
|
-
end
|
143
|
-
@superusers = @search_superusers.result.where.not(permission: permissions_not_accepted)
|
144
|
-
else
|
145
|
-
@superusers = @search_superusers.result
|
146
|
-
end
|
147
|
-
@superusers = @superusers.order(
|
148
|
-
'username ASC'
|
149
|
-
).paginate(page: params[:page], per_page: 10)
|
99
|
+
# controllo che l'utente da eliminare non abbia permessi maggiori o
|
100
|
+
# uguali all'utente eliminatore
|
101
|
+
if superuser.permission >= core_getCurrentUser.permission
|
102
|
+
flash[:warning] = CORE_LANG['superusers']['permission_destroy']
|
103
|
+
redirect_to lato_core.superusers_path and return false
|
150
104
|
end
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
params.require(:superuser).permit(:name, :username, :email, :permission,
|
156
|
-
:password, :password_digest)
|
105
|
+
# controllo che non ci siano stati errori durante l'eliminazione
|
106
|
+
unless superuser.destroy
|
107
|
+
flash[:danger] = CORE_LANG['superusers']['failed_destroy']
|
108
|
+
redirect_to lato_core.superuser_path(superuser) and return false
|
157
109
|
end
|
158
110
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
end
|
111
|
+
flash[:success] = CORE_LANG['superusers']['success_destroy']
|
112
|
+
redirect_to lato_core.superusers_path
|
113
|
+
end
|
163
114
|
|
164
|
-
|
165
|
-
|
166
|
-
|
115
|
+
def show
|
116
|
+
@superuser = LatoCore::Superuser.find(params[:id])
|
117
|
+
# controllo che l'utente da mostrare sia esistente
|
118
|
+
redirect_to lato_core.superusers_path unless @superuser
|
119
|
+
end
|
120
|
+
|
121
|
+
def index
|
122
|
+
@search_superusers = LatoCore::Superuser.ransack(params[:q])
|
123
|
+
# controllo che non vengano mostrati gli utenti impostati nascosti
|
124
|
+
hide_settings = core_getHideUsersSettings
|
125
|
+
if hide_settings && !hide_settings.blank?
|
126
|
+
permissions_not_accepted = []
|
127
|
+
current_user_permission = core_getCurrentUser.permission
|
128
|
+
hide_settings.each do |setting|
|
129
|
+
permissions_not_accepted.push(setting.first) if setting.last.to_i === current_user_permission
|
130
|
+
end
|
131
|
+
@superusers = @search_superusers.result.where.not(permission: permissions_not_accepted)
|
132
|
+
else
|
133
|
+
@superusers = @search_superusers.result
|
167
134
|
end
|
135
|
+
@superusers = @superusers.order(
|
136
|
+
'username ASC'
|
137
|
+
).paginate(page: params[:page], per_page: 10)
|
138
|
+
end
|
168
139
|
|
140
|
+
# This function set default params accepted for user.
|
141
|
+
private def superuser_params
|
142
|
+
params.require(:superuser).permit(:name, :username, :email, :permission,
|
143
|
+
:password, :password_digest)
|
169
144
|
end
|
170
145
|
|
171
146
|
end
|