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
@@ -1,108 +1,94 @@
|
|
1
1
|
module LatoCore
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
# - array di hash contenenti i dati delle voci di menu
|
11
|
-
def core_getNavbarItems
|
12
|
-
return CORE_NAVIGATION if defined? CORE_NAVIGATION
|
13
|
-
getApplicationNavbarItems + getLatoNavbarItems
|
14
|
-
end
|
2
|
+
# This module contains funtions used for the navigation inside the application.
|
3
|
+
module Interface::Navigation
|
4
|
+
|
5
|
+
# This function return an array with navbar voices.
|
6
|
+
def core_getNavbarItems
|
7
|
+
return CORE_NAVIGATION if defined? CORE_NAVIGATION
|
8
|
+
getApplicationNavbarItems + getLatoNavbarItems
|
9
|
+
end
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
gems.each do |name|
|
28
|
-
module_name = name.camelize
|
29
|
-
module_root = module_name.constantize::Engine.root
|
11
|
+
# This function return an array with lato navbar voices.
|
12
|
+
private def getLatoNavbarItems
|
13
|
+
# inizializzo la lista delle voci della navbar
|
14
|
+
navbar_items = []
|
15
|
+
# identifico la lista di gemme del progetto Lato usate dalla
|
16
|
+
# applicazione
|
17
|
+
gems = core_getLatoGems
|
18
|
+
# per ogni gemma estraggo i dati necessari a riempire la navbar
|
19
|
+
gems.each do |name|
|
20
|
+
module_name = name.camelize
|
21
|
+
module_root = module_name.constantize::Engine.root
|
30
22
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
23
|
+
next unless File.exist? "#{module_root}/config/config.yml"
|
24
|
+
# accedo al config.yml
|
25
|
+
config = YAML.load(
|
26
|
+
File.read(File.expand_path("#{module_root}/config/config.yml",
|
27
|
+
__FILE__))
|
28
|
+
)
|
29
|
+
# estraggo i dati dallo yaml
|
30
|
+
data = getConfigNavbarData(config)
|
31
|
+
# aggiungo i dati nella risposta
|
32
|
+
data.each do |single_voice|
|
33
|
+
navbar_items.push(single_voice)
|
43
34
|
end
|
44
|
-
# ritorno il risultato
|
45
|
-
navbar_items
|
46
35
|
end
|
36
|
+
# ritorno il risultato
|
37
|
+
navbar_items
|
38
|
+
end
|
47
39
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
#
|
52
|
-
|
53
|
-
directory = core_getCacheDirectory
|
54
|
-
# inizializzo la lista delle voci della navbar
|
55
|
-
navbar_items = []
|
40
|
+
# This function return an array with application navbar voices.
|
41
|
+
private def getApplicationNavbarItems
|
42
|
+
directory = core_getCacheDirectory
|
43
|
+
# inizializzo la lista delle voci della navbar
|
44
|
+
navbar_items = []
|
56
45
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
46
|
+
if File.exist? "#{directory}/config.yml"
|
47
|
+
# accedo al config.yml
|
48
|
+
directory = core_getCacheDirectory
|
49
|
+
config = YAML.load(
|
50
|
+
File.read(File.expand_path("#{directory}/config.yml", __FILE__))
|
51
|
+
)
|
52
|
+
# estraggo i dati dallo yaml
|
53
|
+
data = getConfigNavbarData(config)
|
54
|
+
# aggiungo i dati nella risposta
|
55
|
+
data.each do |single_voice|
|
56
|
+
navbar_items.push(single_voice)
|
69
57
|
end
|
70
|
-
# ritorno il risultato
|
71
|
-
navbar_items
|
72
58
|
end
|
59
|
+
# ritorno il risultato
|
60
|
+
navbar_items
|
61
|
+
end
|
73
62
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
results.push(output_voice)
|
100
|
-
end
|
63
|
+
# This function read and return config datas about navbar from a config file.
|
64
|
+
private def getConfigNavbarData(config)
|
65
|
+
# inizializzo la lista di dati
|
66
|
+
results = []
|
67
|
+
# se il file e' formattato correttamente esamino ogni sua voce
|
68
|
+
if config and config['menu']
|
69
|
+
config['menu'].each do |voice|
|
70
|
+
# estraggo i dati
|
71
|
+
unique_name = voice[0]
|
72
|
+
name = voice[1]['name'].capitalize
|
73
|
+
url = voice[1]['url'].downcase
|
74
|
+
icon = voice[1]['icon'].downcase
|
75
|
+
position = voice[1]['position']
|
76
|
+
permission = voice[1]['permission']
|
77
|
+
# genero l'oggetto con le informazioni di output
|
78
|
+
output_voice = {
|
79
|
+
unique_name: unique_name,
|
80
|
+
name: name,
|
81
|
+
url: url,
|
82
|
+
icon: icon,
|
83
|
+
position: position,
|
84
|
+
permission: permission
|
85
|
+
}
|
86
|
+
# aggiungo la voce al risultato
|
87
|
+
results.push(output_voice)
|
101
88
|
end
|
102
|
-
# ritorno il risultato
|
103
|
-
results
|
104
89
|
end
|
105
|
-
|
90
|
+
# ritorno il risultato
|
91
|
+
results
|
106
92
|
end
|
107
93
|
|
108
94
|
end
|
@@ -1,71 +1,57 @@
|
|
1
1
|
module LatoCore
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# genero le sessioni
|
23
|
-
session[:user] = user.id
|
24
|
-
session[:session_code] = code
|
25
|
-
# ritorno true
|
26
|
-
return true
|
27
|
-
else
|
28
|
-
# ritorno false
|
29
|
-
return false
|
30
|
-
end
|
2
|
+
# This module contains functions used to get information about user session.
|
3
|
+
module Interface::Session
|
4
|
+
|
5
|
+
# This function create a new session for user with username and
|
6
|
+
# password received as params.
|
7
|
+
def core_createSession(username, password)
|
8
|
+
user = LatoCore::Superuser.find_by(username: username)
|
9
|
+
if user && user.authenticate(password)
|
10
|
+
# genero un session_code
|
11
|
+
code = SecureRandom.urlsafe_base64
|
12
|
+
# memorizzo il session_code sul db
|
13
|
+
user.update_attribute('session_code', code)
|
14
|
+
# genero le sessioni
|
15
|
+
session[:user] = user.id
|
16
|
+
session[:session_code] = code
|
17
|
+
# ritorno true
|
18
|
+
return true
|
19
|
+
else
|
20
|
+
# ritorno false
|
21
|
+
return false
|
31
22
|
end
|
23
|
+
end
|
32
24
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
else
|
49
|
-
# ritorno false
|
50
|
-
return false
|
51
|
-
end
|
25
|
+
# This function destroy the current user session.
|
26
|
+
def core_destroySession
|
27
|
+
if session[:user] && session[:session_code]
|
28
|
+
# determino l'utente della sessione
|
29
|
+
user = LatoCore::Superuser.find(session[:user])
|
30
|
+
# se l'utente esiste elimino il suo session_code dal db
|
31
|
+
user.update_attribute('session_code', nil) if user
|
32
|
+
# elimino le sessioni
|
33
|
+
session[:user] = nil
|
34
|
+
session[:session_code] = nil
|
35
|
+
# ritorno true
|
36
|
+
return true
|
37
|
+
else
|
38
|
+
# ritorno false
|
39
|
+
return false
|
52
40
|
end
|
41
|
+
end
|
53
42
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
# - false se la sessione non esiste o non e' valida
|
58
|
-
def core_controlSession
|
59
|
-
user = LatoCore::Superuser.find(session[:user]) if session[:user]
|
43
|
+
# This function check if user session is valid.
|
44
|
+
def core_controlSession
|
45
|
+
user = LatoCore::Superuser.find(session[:user]) if session[:user]
|
60
46
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
47
|
+
if user && session[:session_code] &&
|
48
|
+
user.session_code === session[:session_code] &&
|
49
|
+
!user.session_code.nil?
|
50
|
+
return true
|
51
|
+
else
|
52
|
+
return false
|
68
53
|
end
|
69
54
|
end
|
55
|
+
|
70
56
|
end
|
71
57
|
end
|
@@ -1,143 +1,134 @@
|
|
1
1
|
module LatoCore
|
2
|
-
module
|
3
|
-
|
4
|
-
# e visualizzazione dei superusers
|
5
|
-
module Superusers
|
2
|
+
# This module contains function used to manage superusers.
|
3
|
+
module Interface::Superusers
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
# This function send a notification email to user with title and
|
6
|
+
# description.
|
7
|
+
def core_notifyUser(user, title, message)
|
8
|
+
# richiamo mailer corretto
|
9
|
+
LatoCore::SuperusersMailer.notify(user, title, message).deliver
|
10
|
+
end
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
|
19
|
-
# definisco permessi iniziali
|
20
|
-
initial_permissions = (1...11).to_a
|
12
|
+
# This function return a list of possible permissions for superusers with
|
13
|
+
# the string name for every permission.
|
14
|
+
def core_getUsersPermissions
|
15
|
+
# definisco permessi iniziali
|
16
|
+
initial_permissions = (1...11).to_a
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
unpermitted = core_getHideUsersPermissionsSettings
|
19
|
+
permitted_permissions = initial_permissions
|
20
|
+
permitted_permissions = initial_permissions - unpermitted if unpermitted
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
permissions = []
|
23
|
+
names = core_getUsersPermissionsNamesSettings
|
24
|
+
return permitted_permissions if !names
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
26
|
+
permitted_permissions.each do |permission|
|
27
|
+
names.each do |name|
|
28
|
+
permissions.push([permission, name.last]) if permission === name.first.to_i
|
34
29
|
end
|
35
|
-
|
36
|
-
return permissions
|
37
30
|
end
|
38
31
|
|
39
|
-
|
40
|
-
|
41
|
-
# un array con la seguente struttura: [[1,4], [1,3]]
|
42
|
-
def core_getHideUsersSettings
|
43
|
-
return CORE_SUPERUSERSHIDESETTINGS if defined? CORE_SUPERUSERSHIDESETTINGS
|
44
|
-
# accedo al config.yml
|
45
|
-
directory = core_getCacheDirectory
|
46
|
-
config = YAML.load(
|
47
|
-
File.read(File.expand_path("#{directory}/config.yml", __FILE__))
|
48
|
-
)
|
49
|
-
# controllo che il file di configurazione esista e abbia i dati necessari
|
50
|
-
return false if !config['hide_users'] || config['hide_users'].nil?
|
51
|
-
# estraggo lista impostazioni utenti da nascondere
|
52
|
-
settings = config['hide_users'].split(',')
|
53
|
-
# definisco output
|
54
|
-
output = []
|
55
|
-
# riempio file di output
|
56
|
-
settings.each do |setting|
|
57
|
-
setting.slice! ' '
|
58
|
-
if setting
|
59
|
-
values = setting.split('to')
|
60
|
-
raise 'Permission value not correct on hide_users config' unless (1..11).to_a.include? values.first.to_i
|
61
|
-
raise 'Permission value not correct on hide_users config' unless (1..11).to_a.include? values.last.to_i
|
62
|
-
output.push([values.first, values.last])
|
63
|
-
end
|
64
|
-
end
|
65
|
-
# ritorno l'output
|
66
|
-
return output
|
67
|
-
end
|
32
|
+
return permissions
|
33
|
+
end
|
68
34
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
config
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
35
|
+
# This function return an array that tells how some users can't see
|
36
|
+
# other users with a specific permission value.
|
37
|
+
def core_getHideUsersSettings
|
38
|
+
return CORE_SUPERUSERSHIDESETTINGS if defined? CORE_SUPERUSERSHIDESETTINGS
|
39
|
+
# accedo al config.yml
|
40
|
+
directory = core_getCacheDirectory
|
41
|
+
config = YAML.load(
|
42
|
+
File.read(File.expand_path("#{directory}/config.yml", __FILE__))
|
43
|
+
)
|
44
|
+
# controllo che il file di configurazione esista e abbia i dati necessari
|
45
|
+
return false if !config['hide_users'] || config['hide_users'].nil?
|
46
|
+
# estraggo lista impostazioni utenti da nascondere
|
47
|
+
settings = config['hide_users'].split(',')
|
48
|
+
# definisco output
|
49
|
+
output = []
|
50
|
+
# riempio file di output
|
51
|
+
settings.each do |setting|
|
52
|
+
setting.slice! ' '
|
53
|
+
if setting
|
54
|
+
values = setting.split('to')
|
55
|
+
raise 'Permission value not correct on hide_users config' unless (1..11).to_a.include? values.first.to_i
|
56
|
+
raise 'Permission value not correct on hide_users config' unless (1..11).to_a.include? values.last.to_i
|
57
|
+
output.push([values.first, values.last])
|
92
58
|
end
|
93
|
-
# ritorno l'output
|
94
|
-
return output
|
95
59
|
end
|
60
|
+
# ritorno l'output
|
61
|
+
return output
|
62
|
+
end
|
96
63
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
config
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
raise 'Permission value not correct on rename_users_permissions config' unless (1..11).to_a.include? values.first.to_i
|
119
|
-
output.push([values.first, values.last])
|
120
|
-
end
|
64
|
+
# This function return an array of permissions value that must be hidden
|
65
|
+
# from the user interface.
|
66
|
+
def core_getHideUsersPermissionsSettings
|
67
|
+
return CORE_SUPERUSERSPERMISSIONSHIDESETTINGS if defined? CORE_SUPERUSERSPERMISSIONSHIDESETTINGS
|
68
|
+
# accedo al config.yml
|
69
|
+
directory = core_getCacheDirectory
|
70
|
+
config = YAML.load(
|
71
|
+
File.read(File.expand_path("#{directory}/config.yml", __FILE__))
|
72
|
+
)
|
73
|
+
# controllo che il file di configurazione esista e abbia i dati necessari
|
74
|
+
return false if !config['hide_users_permissions'] || config['hide_users_permissions'].nil?
|
75
|
+
# estraggo lista impostazioni utenti da nascondere
|
76
|
+
settings = config['hide_users_permissions'].to_s.split(',')
|
77
|
+
# definisco output
|
78
|
+
output = []
|
79
|
+
# riempio file di output
|
80
|
+
settings.each do |setting|
|
81
|
+
setting.slice! ' '
|
82
|
+
if setting
|
83
|
+
raise 'Permission value not correct on hide_users_permissions config' unless (1..11).to_a.include? setting.to_i
|
84
|
+
output.push(setting.to_i)
|
121
85
|
end
|
122
|
-
# ritorno l'output
|
123
|
-
return output
|
124
86
|
end
|
87
|
+
# ritorno l'output
|
88
|
+
return output
|
89
|
+
end
|
125
90
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
91
|
+
# This function return an array with correct name fr every permission
|
92
|
+
# if name is set on config file.
|
93
|
+
def core_getUsersPermissionsNamesSettings
|
94
|
+
return CORE_SUPERUSERSPERMISSIONSNAMESSETTINGS if defined? CORE_SUPERUSERSPERMISSIONSNAMESSETTINGS
|
95
|
+
# accedo al config.yml
|
96
|
+
directory = core_getCacheDirectory
|
97
|
+
config = YAML.load(
|
98
|
+
File.read(File.expand_path("#{directory}/config.yml", __FILE__))
|
99
|
+
)
|
100
|
+
# controllo che il file di configurazione esista e abbia i dati necessari
|
101
|
+
return false if !config['rename_users_permissions'] || config['rename_users_permissions'].nil?
|
102
|
+
# estraggo lista impostazioni utenti da nascondere
|
103
|
+
settings = config['rename_users_permissions'].split(',')
|
104
|
+
# definisco output
|
105
|
+
output = []
|
106
|
+
# riempio file di output
|
107
|
+
settings.each do |setting|
|
108
|
+
setting.slice! ' '
|
109
|
+
if setting
|
110
|
+
values = setting.split('-')
|
111
|
+
raise 'Permission value not correct on rename_users_permissions config' unless (1..11).to_a.include? values.first.to_i
|
112
|
+
output.push([values.first, values.last])
|
113
|
+
end
|
139
114
|
end
|
115
|
+
# ritorno l'output
|
116
|
+
return output
|
117
|
+
end
|
140
118
|
|
119
|
+
# This function tells if is possible for user to recover his password.
|
120
|
+
def core_getRecoveryPasswordPermission
|
121
|
+
return CORE_RECOVERYPASSWORDPERMISSION if defined? CORE_RECOVERYPASSWORDPERMISSION
|
122
|
+
# accedo al config.yml
|
123
|
+
directory = core_getCacheDirectory
|
124
|
+
config = YAML.load(
|
125
|
+
File.read(File.expand_path("#{directory}/config.yml", __FILE__))
|
126
|
+
)
|
127
|
+
# controllo che il file di configurazione esista e abbia i dati necessari
|
128
|
+
return false if !config['recovery_password'] || config['recovery_password'].nil?
|
129
|
+
# ritorno valore letto
|
130
|
+
return config['recovery_password']
|
141
131
|
end
|
132
|
+
|
142
133
|
end
|
143
134
|
end
|