gestion 1.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +48 -0
- data/.project +14 -0
- data/Binaries/adduser_to_buzz +15 -0
- data/Binaries/backup +7 -0
- data/Binaries/check_gestion +8 -0
- data/Binaries/gestion.gnumail +22 -0
- data/Binaries/gestion.logrotate +34 -0
- data/Binaries/gestion.service +12 -0
- data/Binaries/gestion_update.rb +183 -0
- data/Binaries/gestion_update.service +10 -0
- data/Binaries/get_compta +11 -0
- data/Binaries/kill_gestion +16 -0
- data/Binaries/ldap/add_indexes +51 -0
- data/Binaries/ldap/backup +2 -0
- data/Binaries/ldap/install_ldap +92 -0
- data/Binaries/ldap/restore +7 -0
- data/Binaries/lib_backup +5 -0
- data/Binaries/log_scan_errors +8 -0
- data/Binaries/loop_gestion +64 -0
- data/Binaries/onetimers/sync_courses_from_compta.rb +74 -0
- data/Binaries/onetimers/transfer_cash_from_ldap_to_csv +26 -0
- data/Binaries/reboot +5 -0
- data/Binaries/restore +3 -0
- data/Binaries/restore_do +22 -0
- data/Binaries/sort_events +31 -0
- data/Binaries/start_gestion +18 -0
- data/Binaries/swipe_gestion +18 -0
- data/Binaries/update_africompta +21 -0
- data/Binaries/update_users +3 -0
- data/Diplomas.src/accredited.odg +0 -0
- data/Diplomas.src/diploma.odg +0 -0
- data/Diplomas.src/label.odg +0 -0
- data/Diplomas.src/presence_sheet.ods +0 -0
- data/Diplomas.src/presence_sheet_small.ods +0 -0
- data/Diplomas.src/student_card.odg +0 -0
- data/Doc/130514-it-ideas.odt +0 -0
- data/Doc/Compta-cash.mm +179 -0
- data/Doc/General.odt +0 -0
- data/Entities/AccessGroups.rb +117 -0
- data/Entities/Activity.rb +178 -0
- data/Entities/ChatMsg.rb +142 -0
- data/Entities/Classroom.rb +11 -0
- data/Entities/Client.rb +19 -0
- data/Entities/Computer.rb +21 -0
- data/Entities/ConfigBase.rb +280 -0
- data/Entities/Course.rb +1588 -0
- data/Entities/CourseType.rb +171 -0
- data/Entities/DFiles.rb +466 -0
- data/Entities/FilesManage.rb +226 -0
- data/Entities/Grade.rb +186 -0
- data/Entities/Internet.rb +300 -0
- data/Entities/Netdev.rb +10 -0
- data/Entities/Person.rb +1175 -0
- data/Entities/Plug.rb +98 -0
- data/Entities/Quiz.rb +33 -0
- data/Entities/Recharges.rb +37 -0
- data/Entities/Report.rb +136 -0
- data/Entities/Room.rb +12 -0
- data/Entities/SMS.rb +30 -0
- data/Entities/ScheduleType.rb +33 -0
- data/Entities/Share.rb +120 -0
- data/Entities/Task.rb +51 -0
- data/Entities/Ticket.rb +72 -0
- data/Entities/Usage.rb +143 -0
- data/Entities/Worker.rb +29 -0
- data/Files/apache-profeda.conf +36 -0
- data/Files/label.erb +121 -0
- data/Files/label_notfound.erb +64 -0
- data/Files/label_notpassed.erb +84 -0
- data/Files/mobileinfo.erb +115 -0
- data/Files/smb.conf +333 -0
- data/Files/timetable.html +36 -0
- data/Files/timetable.js +239 -0
- data/Gemfile +12 -0
- data/Gemfile.dev +12 -0
- data/Gemfile.dev.lock +127 -0
- data/Gemfile.lock +127 -0
- data/Gemfile.prod +8 -0
- data/Gestion +35 -0
- data/Gestion.rb +220 -0
- data/INSTALL +40 -0
- data/Images/connection.xcf +0 -0
- data/Images/connection_no.png +0 -0
- data/Images/connection_wait.png +0 -0
- data/Images/connection_yes.png +0 -0
- data/Paths/Exas.rb +13 -0
- data/Paths/Files.rb +19 -0
- data/Paths/GetDiplomas.rb +20 -0
- data/Paths/Info.rb +114 -0
- data/Paths/Label.rb +187 -0
- data/Paths/MobileInfo.rb +19 -0
- data/Paths/internetCash.rb +34 -0
- data/Paths/internetWifi.rb +54 -0
- data/README.md +60 -0
- data/Rakefile +13 -0
- data/TODO +1391 -0
- data/Test/.gitignore +3 -0
- data/Test/Diplomas/base_gestion.odt +0 -0
- data/Test/Diplomas/base_report.odt +0 -0
- data/Test/Diplomas/carte_etudiant.odg +0 -0
- data/Test/Diplomas/exam_language.odt +0 -0
- data/Test/Diplomas/label.odg +0 -0
- data/Test/Diplomas/presence_sheet.ods +0 -0
- data/Test/Diplomas/presence_sheet_small.ods +0 -0
- data/Test/Diplomas/student_card.odg +0 -0
- data/Test/Manual/testMerge +18 -0
- data/Test/config_test.yaml +26 -0
- data/Test/db.testGestion +0 -0
- data/Test/dfiles/descs/avg-rescue.desc +10 -0
- data/Test/dfiles/descs/avg.desc +8 -0
- data/Test/dfiles/descs/driver.desc +8 -0
- data/Test/dfiles/descs/linuxmint.desc +7 -0
- data/Test/dfiles/files/avg-160203.exe +1 -0
- data/Test/dfiles/files/avg.iso +1 -0
- data/Test/dfiles/files/driver.exe +1 -0
- data/Test/dfiles/index_post.html +3 -0
- data/Test/dfiles/index_pre.html +8 -0
- data/Test/dfiles/priorities +5 -0
- data/Test/ge_activity.rb +124 -0
- data/Test/ge_chat.rb +106 -0
- data/Test/ge_compta.rb +67 -0
- data/Test/ge_configbase.rb +54 -0
- data/Test/ge_course.rb +1114 -0
- data/Test/ge_dfiles.rb +121 -0
- data/Test/ge_filesmanage.rb +180 -0
- data/Test/ge_info.rb +27 -0
- data/Test/ge_internet.rb +246 -0
- data/Test/ge_login.rb +55 -0
- data/Test/ge_person.rb +373 -0
- data/Test/ge_qvinfo.rb +28 -0
- data/Test/ge_report.rb +97 -0
- data/Test/ge_share.rb +27 -0
- data/Test/ge_sms.rb +34 -0
- data/Test/ge_tasks.rb +19 -0
- data/Test/ge_usage.rb +168 -0
- data/Test/ge_view.rb +46 -0
- data/Test/multiconf-captive +29 -0
- data/Test/test.conf +7 -0
- data/Test/test.rb +49 -0
- data/Test/test_bytes.png +0 -0
- data/VERSION +140 -0
- data/Views/Admin/Backup.rb +91 -0
- data/Views/Admin/Configuration.rb +44 -0
- data/Views/Admin/Credit.rb +32 -0
- data/Views/Admin/FilesManage.rb +219 -0
- data/Views/Admin/Function.rb +39 -0
- data/Views/Admin/Power.rb +49 -0
- data/Views/Admin/Printer.rb +37 -0
- data/Views/Admin/Server.rb +252 -0
- data/Views/Admin/Tabs.rb +5 -0
- data/Views/Admin/Update.rb +73 -0
- data/Views/Admin/UpdateSystem.rb +26 -0
- data/Views/Cashbox/Activity.rb +191 -0
- data/Views/Cashbox/Course.rb +141 -0
- data/Views/Cashbox/Credit.rb +79 -0
- data/Views/Cashbox/Report.rb +115 -0
- data/Views/Cashbox/Service.rb +105 -0
- data/Views/Cashbox/Tabs.rb +10 -0
- data/Views/Compta/Accounts.rb +36 -0
- data/Views/Compta/Course.rb +96 -0
- data/Views/Compta/Show.rb +6 -0
- data/Views/Compta/Transfer.rb +66 -0
- data/Views/Course/Diploma.rb +203 -0
- data/Views/Course/Grade.rb +401 -0
- data/Views/Course/Modify.rb +447 -0
- data/Views/Course/Print.rb +94 -0
- data/Views/Course/Responsible.rb +44 -0
- data/Views/Course/Stats.rb +76 -0
- data/Views/Course/Students.rb +92 -0
- data/Views/Course/Tabs.rb +220 -0
- data/Views/Internet/Access.rb +134 -0
- data/Views/Internet/ClassEdit.rb +24 -0
- data/Views/Internet/ClassUsers.rb +81 -0
- data/Views/Internet/Config.rb +32 -0
- data/Views/Internet/Mobile.rb +213 -0
- data/Views/Internet/Recharges.rb +49 -0
- data/Views/Internet/Tabs.rb +6 -0
- data/Views/Inventory/Computer.rb +24 -0
- data/Views/Inventory/Room.rb +18 -0
- data/Views/Inventory/Tabs.rb +9 -0
- data/Views/Inventory/TicketClosed.rb +7 -0
- data/Views/Inventory/TicketOpen.rb +23 -0
- data/Views/Library/Person.rb +36 -0
- data/Views/Library/Tabs.rb +7 -0
- data/Views/Network/Block.rb +87 -0
- data/Views/Network/Netdevs.rb +21 -0
- data/Views/Network/Restriction.rb +37 -0
- data/Views/Network/Share.rb +167 -0
- data/Views/Network/Tables.rb +28 -0
- data/Views/Network/Tabs.rb +6 -0
- data/Views/Person/Admin.rb +99 -0
- data/Views/Person/Center.rb +48 -0
- data/Views/Person/Course.rb +72 -0
- data/Views/Person/Modify.rb +153 -0
- data/Views/Person/Tabs.rb +162 -0
- data/Views/Report/ComptaExecutive.rb +221 -0
- data/Views/Report/ComptaFlat.rb +79 -0
- data/Views/Report/ReportCourse.rb +47 -0
- data/Views/Report/Tabs.rb +8 -0
- data/Views/Report/Usage.rb +52 -0
- data/Views/Report/UsageCases.rb +59 -0
- data/Views/Self/Cash.rb +67 -0
- data/Views/Self/Chat.rb +55 -0
- data/Views/Self/Concours.rb +109 -0
- data/Views/Self/Email.rb +34 -0
- data/Views/Self/Internet.rb +255 -0
- data/Views/Self/Results.rb +17 -0
- data/Views/Self/Services.rb +85 -0
- data/Views/Self/Show.rb +47 -0
- data/Views/Self/Tabs.rb +5 -0
- data/Views/Special/DFileEdit.rb +13 -0
- data/Views/Special/PlugEdit.rb +56 -0
- data/Views/Special/Tabs.rb +6 -0
- data/Views/Special/Vnc.rb +39 -0
- data/Views/Task/Client.rb +21 -0
- data/Views/Task/Edit.rb +33 -0
- data/Views/Task/List.rb +55 -0
- data/Views/Task/Tabs.rb +9 -0
- data/Views/Task/Worker.rb +30 -0
- data/Views/Template/Activity.rb +33 -0
- data/Views/Template/CourseType.rb +63 -0
- data/Views/Template/ScheduleType.rb +29 -0
- data/Views/Template/Tabs.rb +5 -0
- data/Views/Welcome.rb +121 -0
- data/config.yaml.default +36 -0
- data/po/Gestion-ar.po +2356 -0
- data/po/Gestion-en.mo +0 -0
- data/po/Gestion-en.po +4363 -0
- data/po/Gestion-fr.mo +0 -0
- data/po/Gestion-fr.po +4345 -0
- data/po/traduction-ar.rtf +76 -0
- metadata +381 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
class SpecialVNC < View
|
2
|
+
def layout
|
3
|
+
@order = 100
|
4
|
+
@auto_update = 5
|
5
|
+
@update = true
|
6
|
+
@functions_need = [:special_vnc]
|
7
|
+
|
8
|
+
gui_vbox do
|
9
|
+
show_str :ip
|
10
|
+
show_str :password
|
11
|
+
show_str_ro :status
|
12
|
+
show_button :start_x
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def rpc_update(session)
|
17
|
+
reply(:update, password: @static._password) +
|
18
|
+
reply(:update, ip: session.client_ip) +
|
19
|
+
rpc_update_with_values(nil, nil)
|
20
|
+
end
|
21
|
+
|
22
|
+
def rpc_update_with_values(session, data)
|
23
|
+
reply(:update, status: System.run_str('pgrep -af vnc'))
|
24
|
+
end
|
25
|
+
|
26
|
+
def rpc_button_start_x(session, data)
|
27
|
+
@static._password = data._password
|
28
|
+
if Platform.system == :ArchLinux
|
29
|
+
System.run_str("echo #{data._password} | vncpasswd -f > /root/.vnc/passwd")
|
30
|
+
IO.write('/root/.xinitrc',
|
31
|
+
"xset -dpms; xset s off
|
32
|
+
x0vncserver -passwordfile ~/.vnc/passwd &
|
33
|
+
vncviewer -fullscreen -shared -viewonly -passwd=/root/.vnc/passwd #{data._ip}")
|
34
|
+
System.run_bool('killall -9 xinit')
|
35
|
+
System.run_bool('killall -9 Xorg')
|
36
|
+
Platform.start 'startx@root'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class TaskClient < View
|
2
|
+
include VTListPane
|
3
|
+
|
4
|
+
def layout
|
5
|
+
set_data_class :Clients
|
6
|
+
|
7
|
+
gui_hbox do
|
8
|
+
gui_vbox :nogroup do
|
9
|
+
vtlp_list :clients, 'name'
|
10
|
+
show_button :delete
|
11
|
+
end
|
12
|
+
gui_vbox :nogroup do
|
13
|
+
#show_find :name
|
14
|
+
show_block :prices
|
15
|
+
show_block :address
|
16
|
+
show_block :contact
|
17
|
+
show_button :new, :save
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/Views/Task/Edit.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
class TaskEdit < View
|
2
|
+
include VTListPane
|
3
|
+
|
4
|
+
def layout
|
5
|
+
set_data_class :Tasks
|
6
|
+
@update = true
|
7
|
+
|
8
|
+
gui_hbox do
|
9
|
+
gui_vbox :nogroup do
|
10
|
+
vtlp_list :tasks, "tasks"
|
11
|
+
show_button :delete
|
12
|
+
end
|
13
|
+
gui_vbox :nogroup do
|
14
|
+
show_list_drop :client, "Entities.Clients.list_name"
|
15
|
+
show_list_drop :person, "Entities.Workers.list_full_name"
|
16
|
+
show_block :work
|
17
|
+
show_block :other
|
18
|
+
|
19
|
+
show_button :save, :new
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def rpc_update( session )
|
25
|
+
vtlp_update_list( session )
|
26
|
+
end
|
27
|
+
|
28
|
+
def rpc_button_save( session, data )
|
29
|
+
if data['date']
|
30
|
+
super( session, data )
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/Views/Task/List.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
class TaskList < View
|
2
|
+
|
3
|
+
def layout
|
4
|
+
set_data_class :Tasks
|
5
|
+
@update = true
|
6
|
+
|
7
|
+
gui_hbox do
|
8
|
+
gui_vbox :nogroup do
|
9
|
+
show_list_drop :year, "View.TaskList.list_years"
|
10
|
+
show_list_drop :month, "1.upto(12).to_a"
|
11
|
+
show_list_drop :person, "Entities.Workers.list_full_name"
|
12
|
+
show_list_drop :client, "Entities.Clients.list_name"
|
13
|
+
show_button :list
|
14
|
+
end
|
15
|
+
gui_vbox :nogroup do
|
16
|
+
show_text :tasks_done
|
17
|
+
show_text :summary
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def list_years
|
23
|
+
to = from = Time.now.year
|
24
|
+
Entities.Tasks.list_date{|d|
|
25
|
+
year = d.sub( /.*\./, '' )
|
26
|
+
dputs( 5 ){ "date is #{d}, year is #{year}" }
|
27
|
+
from = [ from, year ].min
|
28
|
+
to = [ to, year ].max
|
29
|
+
}
|
30
|
+
dputs( 5 ){ "from #{from} to #{to}" }
|
31
|
+
from.upto( to ).to_a
|
32
|
+
end
|
33
|
+
|
34
|
+
def rpc_button_list( session, data )
|
35
|
+
dputs( 3 ){ data.inspect }
|
36
|
+
worker = Entities.Workers.find_full_name( data["person"][0] )
|
37
|
+
dputs( 3 ){ worker.inspect }
|
38
|
+
client = Entities.Clients.match_by_name( data["client"][0] )
|
39
|
+
dputs( 3 ){ client.inspect }
|
40
|
+
list = Tasks.list_task_month( worker, data["year"][0], data["month"][0], client)
|
41
|
+
dputs( 3 ){ list.inspect }
|
42
|
+
tasks = ""
|
43
|
+
hours = 0.0
|
44
|
+
list.sort{|a,b| a[:date] <=> b[:date] }.each{|l|
|
45
|
+
duration = l[:duration_hours]
|
46
|
+
tasks += "#{l[:date]} - #{duration} hour#{ duration.to_f < 2 ? '' : 's'}\n" +
|
47
|
+
"#{l[:work]}\n"
|
48
|
+
hours += l[:duration_hours].to_f
|
49
|
+
}
|
50
|
+
price = worker.function[0] == "assistant" ? client.price_assistant : client.price_expert
|
51
|
+
summary = "#{data['month']} #{hours} #{( hours * price.to_i ).to_i}"
|
52
|
+
reply( "update", { :tasks_done => tasks, :summary => summary } )
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
data/Views/Task/Tabs.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
class TaskWorker < View
|
2
|
+
include VTListPane
|
3
|
+
|
4
|
+
def layout
|
5
|
+
set_data_class :Workers
|
6
|
+
|
7
|
+
gui_hbox do
|
8
|
+
gui_vbox :nogroup do
|
9
|
+
vtlp_list :workers, "login_name"
|
10
|
+
show_button :delete
|
11
|
+
end
|
12
|
+
gui_vbox :nogroup do
|
13
|
+
#show_find :login_name
|
14
|
+
#show_find :person_id
|
15
|
+
show_block :work
|
16
|
+
|
17
|
+
show_button :new, :save
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Standard search-field action to take
|
23
|
+
def rpc_find( session, field, data )
|
24
|
+
rep = Entities.Persons.find( field, data )
|
25
|
+
if not rep
|
26
|
+
rep = { "#{field}" => data }
|
27
|
+
end
|
28
|
+
reply( :update, rep ) + rpc_update( session )
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
class TemplateActivity < View
|
5
|
+
include VTListPane
|
6
|
+
|
7
|
+
def layout
|
8
|
+
#set_data_class :Activities
|
9
|
+
@order = 200
|
10
|
+
|
11
|
+
@functions_need = [:activities]
|
12
|
+
|
13
|
+
gui_hboxg do
|
14
|
+
gui_vboxg :nogroup do
|
15
|
+
vtlp_list :activity, 'name', :flexheight => 1
|
16
|
+
show_button :new, :delete
|
17
|
+
end
|
18
|
+
|
19
|
+
gui_vboxg :nogroup do
|
20
|
+
show_block :default
|
21
|
+
show_block :show
|
22
|
+
show_list_drop :card_filename, 'Activities.files.sort'
|
23
|
+
show_field :tags
|
24
|
+
show_field :internet_limit
|
25
|
+
show_button :save
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def rpc_list_choice_internetClass(session, name, args)
|
31
|
+
# dp name, args
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
class TemplateCourseType < View
|
5
|
+
include VTListPane
|
6
|
+
|
7
|
+
def layout
|
8
|
+
set_data_class :CourseTypes
|
9
|
+
@update = :before
|
10
|
+
@order = 100
|
11
|
+
|
12
|
+
@functions_need = [:courses]
|
13
|
+
|
14
|
+
gui_hboxg do
|
15
|
+
gui_vbox :nogroup do
|
16
|
+
vtlp_list :ctype, 'name', :flexheight => 1
|
17
|
+
show_button :new, :delete
|
18
|
+
end
|
19
|
+
|
20
|
+
gui_vboxg do
|
21
|
+
gui_hboxg :nogroup do
|
22
|
+
gui_vboxg :nogroup do
|
23
|
+
show_block :strings
|
24
|
+
show_block :long
|
25
|
+
show_block :accounting
|
26
|
+
end
|
27
|
+
gui_vbox :nogroup do
|
28
|
+
show_block :central
|
29
|
+
show_list_drop :file_diploma, 'CourseTypes.files.sort', :width => 200
|
30
|
+
show_list_drop :file_exam, 'CourseTypes.files.sort', :width => 200
|
31
|
+
end
|
32
|
+
end
|
33
|
+
gui_hboxg :nogroup do
|
34
|
+
gui_vboxg :nogroup do
|
35
|
+
show_int_ro :tests_nbr
|
36
|
+
show_text :tests_str, :flexheight => 1, :width => 200
|
37
|
+
end
|
38
|
+
gui_vboxg :nogroup do
|
39
|
+
show_int_ro :files_nbr
|
40
|
+
show_text :files_str, :flexheight => 1, :width => 200
|
41
|
+
end
|
42
|
+
end
|
43
|
+
gui_vbox :nogroup do
|
44
|
+
show_field :account_base
|
45
|
+
show_arg :account_base, :width => 400
|
46
|
+
end
|
47
|
+
show_button :save
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def rpc_update_view(session)
|
53
|
+
super(session) +
|
54
|
+
reply(:empty_nonlists) +
|
55
|
+
reply(:select, account_base: AccountRoot.actual.listp_path) +
|
56
|
+
reply_visible(ConfigBase.has_function?(:accounting_courses),
|
57
|
+
:account_base)
|
58
|
+
end
|
59
|
+
|
60
|
+
def rpc_update(session)
|
61
|
+
reply(:update, :account_base => [0])
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class TemplateScheduleType < View
|
2
|
+
#include VTListPane
|
3
|
+
|
4
|
+
def layout
|
5
|
+
@order=400
|
6
|
+
@update = true
|
7
|
+
@visible = false
|
8
|
+
|
9
|
+
gui_hboxg do
|
10
|
+
#gui_vboxg :nogroup do
|
11
|
+
#vtlp_list :stype, :name, :flexheight => 1
|
12
|
+
#show_button :new, :delete
|
13
|
+
#end
|
14
|
+
gui_vboxg :nogroup do
|
15
|
+
show_html :choice, :flex => 1
|
16
|
+
show_button :save, :render
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def rpc_update(session)
|
22
|
+
reply(:update, :choice => ScheduleTypes.get_html) +
|
23
|
+
reply(:eval, ScheduleTypes.get_script)
|
24
|
+
end
|
25
|
+
|
26
|
+
def rpc_button_render(session, data)
|
27
|
+
reply(:eval, 'add_days();add_hours();')
|
28
|
+
end
|
29
|
+
end
|
data/Views/Welcome.rb
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
class Welcome < View
|
2
|
+
def dummy_for_translation
|
3
|
+
show_str :username
|
4
|
+
show_str :version
|
5
|
+
show_str :direct_connect
|
6
|
+
show_str :simple_connect
|
7
|
+
end
|
8
|
+
|
9
|
+
# Overwrite the standard rpc_show to speed up testing...
|
10
|
+
def rpc_show(session)
|
11
|
+
# GC.start
|
12
|
+
web_req = session.web_req
|
13
|
+
client_ip = RPCQooxdooHandler.get_ip(web_req)
|
14
|
+
person = if get_config(false, :autologin)
|
15
|
+
Entities.Persons.match_by_login_name(get_config(false, :autologin))
|
16
|
+
else
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
if person
|
20
|
+
person and dputs(3) { "Found login #{person.data.inspect}" }
|
21
|
+
session = get_config(false, :multilogin) ? Sessions.find_by_owner(person.person_id) : nil
|
22
|
+
session ||= Sessions.create(person)
|
23
|
+
dputs(3) { "Session is #{session.inspect}" }
|
24
|
+
return reply(:session_id, person.session_id) +
|
25
|
+
View.rpc_list(session)
|
26
|
+
else
|
27
|
+
if session.web_req && ref = session.web_req.header._referer
|
28
|
+
user, pass = ref.first.match(/user=(.*)&pass=(.*)/).to_a[1..2]
|
29
|
+
if user && pass
|
30
|
+
return rpc_button_direct_connect(session, {username: user, password: pass})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
Sessions.search_by_owner('[0-9]').each { |s|
|
34
|
+
if s.last_seen && Time.now.to_i - s.last_seen.to_i <= 15
|
35
|
+
log_msg :Welcome, "Found session #{s.inspect} from ip #{s.client_ip}"
|
36
|
+
if s.client_ip == client_ip
|
37
|
+
log_msg :Welcome, "Found session #{s.inspect} with correct ip"
|
38
|
+
#dp person = session.owner
|
39
|
+
#session = Sessions.create( person )
|
40
|
+
return direct_connect(s)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
}
|
44
|
+
super +
|
45
|
+
reply(:update, :version => VERSION_GESTION) +
|
46
|
+
reply(:update, :links => ConfigBase.welcome_text) +
|
47
|
+
reply_visible(ConfigBase.has_function?(:internet_captive), :direct_connect)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# On pressing of the login-button, we search for the user and check the password
|
52
|
+
def rpc_button_simple_connect(session, args)
|
53
|
+
#dputs_func
|
54
|
+
dputs(3) { "args is #{args.inspect}" }
|
55
|
+
login_name, password = args._username.gsub(/ /, '').downcase, args._password
|
56
|
+
person = Persons.match_by_login_name(login_name)
|
57
|
+
if person
|
58
|
+
dputs(3) { "Person is #{person.inspect} and #{person.password}" }
|
59
|
+
end
|
60
|
+
if password.to_s.length == 0 then
|
61
|
+
return reply(:focus, :password)
|
62
|
+
elsif person and person.check_pass(password) then
|
63
|
+
web_req = session.web_req
|
64
|
+
session = Sessions.create(person)
|
65
|
+
session.web_req = web_req
|
66
|
+
session.client_ip = RPCQooxdooHandler.get_ip(web_req)
|
67
|
+
dputs(3) { "Found login #{person.data_get(:person_id)} for #{login_name}" }
|
68
|
+
dputs(3) { "Session is #{session.inspect}" }
|
69
|
+
log_msg :Welcome, "Authenticated person #{person.login_name} from " +
|
70
|
+
"#{session.client_ip}"
|
71
|
+
return reply(:session_id, person.session_id) +
|
72
|
+
View.rpc_list(session)
|
73
|
+
else
|
74
|
+
reply(:window_show, :login_failed) +
|
75
|
+
reply(:update, :reason => person ? 'Password wrong' : "User doesn't exist")
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def direct_connect(session)
|
80
|
+
if !session or !session.owner
|
81
|
+
return reply(:window_show, :login_failed) +
|
82
|
+
reply(:update, :reason => 'Please enter a valid login')
|
83
|
+
end
|
84
|
+
|
85
|
+
if View.SelfInternet.can_connect(session) == 0
|
86
|
+
dputs(2) { "Auto-connecting #{session.owner.login_name}" }
|
87
|
+
View.SelfInternet.rpc_button_connect(session, nil)
|
88
|
+
end
|
89
|
+
|
90
|
+
tabs = View.list(session)._views
|
91
|
+
|
92
|
+
dputs(3) { "Tabs starts as #{tabs.inspect}" }
|
93
|
+
selftabs = tabs.find { |v| v.first == 'SelfTabs' }
|
94
|
+
tabs.delete_if { |v| v.first == 'SelfTabs' }
|
95
|
+
if selftabs
|
96
|
+
tabs.unshift selftabs
|
97
|
+
end
|
98
|
+
|
99
|
+
dputs(3) { "Tabs is now #{tabs.inspect}" }
|
100
|
+
return reply(:session_id, session.sid) +
|
101
|
+
reply(:list, views: tabs) +
|
102
|
+
(session.s_data._sub_tabs_only ? View.reply(:bar_position, 'top') : [])
|
103
|
+
end
|
104
|
+
|
105
|
+
def rpc_button_direct_connect(session, args)
|
106
|
+
ret = rpc_button_simple_connect(session, args)
|
107
|
+
if ret.first._cmd == :window_show
|
108
|
+
return ret
|
109
|
+
else
|
110
|
+
session = Sessions.find_by_sid(ret.first._data)
|
111
|
+
return direct_connect(session)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# On logout
|
116
|
+
def rpc_button_logout(session)
|
117
|
+
session.close
|
118
|
+
return super.rpc_show(session)
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
data/config.yaml.default
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Uncomment to automatically login admin
|
2
|
+
#autologin: admin
|
3
|
+
# Together with autologin, allows for more than one at the same time,
|
4
|
+
# for example for chat
|
5
|
+
#multilogin: true
|
6
|
+
|
7
|
+
StorageHandler:
|
8
|
+
Replace:
|
9
|
+
LDAP: CSV
|
10
|
+
|
11
|
+
StorageType:
|
12
|
+
CSV:
|
13
|
+
backup_count: 5
|
14
|
+
|
15
|
+
#profiling: profile.txt
|
16
|
+
# duration: 30
|
17
|
+
|
18
|
+
Webrick:
|
19
|
+
# port: 3302
|
20
|
+
|
21
|
+
Views:
|
22
|
+
# CourseTabs:
|
23
|
+
# order: 0
|
24
|
+
|
25
|
+
# These can come in handy for a backup-system where data of an online system
|
26
|
+
# are tested
|
27
|
+
Entities:
|
28
|
+
Share:
|
29
|
+
# simulation: true
|
30
|
+
Persons:
|
31
|
+
# user_simulation: true
|
32
|
+
|
33
|
+
LDAPConfig:
|
34
|
+
# array: host, base, root, group_users, password
|
35
|
+
# ldapscripts: /etc/ldapscripts/ldapscripts.conf
|
36
|
+
# ldapsecret: /etc/ldap.secret
|