diff options
-rw-r--r-- | app/controllers/sip_accounts_controller.rb | 2 | ||||
-rw-r--r-- | app/models/ability.rb | 5 | ||||
-rw-r--r-- | app/views/layouts/_navbar.html.haml | 4 | ||||
-rw-r--r-- | config/backup.rb | 24 | ||||
-rw-r--r-- | config/locales/views/restore_jobs/de.yml | 2 | ||||
-rw-r--r-- | config/locales/views/restore_jobs/en.yml | 2 | ||||
-rw-r--r-- | lib/tasks/backup.rake | 16 |
7 files changed, 45 insertions, 10 deletions
diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb index ef1aab8..621bd3c 100644 --- a/app/controllers/sip_accounts_controller.rb +++ b/app/controllers/sip_accounts_controller.rb @@ -1,7 +1,7 @@ class SipAccountsController < ApplicationController load_resource :user load_resource :tenant - load_resource :sip_account, :only => [:call] + load_and_authorize_resource :sip_account, :only => [:call] load_and_authorize_resource :sip_account, :through => [:user, :tenant ] before_filter :set_and_authorize_parent diff --git a/app/models/ability.rb b/app/models/ability.rb index be64528..3ba4481 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -90,6 +90,11 @@ class Ability # SIM cards # cannot [:edit, :update], SimCard + + # Restore is only possible on a new system. + # + cannot :manage, RestoreJob + else # Any user can do the following stuff. # diff --git a/app/views/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml index a7f47cf..8004c0e 100644 --- a/app/views/layouts/_navbar.html.haml +++ b/app/views/layouts/_navbar.html.haml @@ -3,10 +3,12 @@ .container %span.hidden-phone %a.brand{:href => (current_user.nil? ? '/' : tenant_path(current_user.current_tenant))} - Gemeinschaft 5 + Gemeinschaft 5.1 .nav-collapse.collapse %ul.nav + - if !GemeinschaftSetup.any? + %li=link_to t('restore_jobs.new.page_title'), new_restore_job_path - if current_user && GemeinschaftSetup.any? && current_user.admin? - if current_page?(page_help_path) %li.active diff --git a/config/backup.rb b/config/backup.rb index 1c79c04..b50f7a8 100644 --- a/config/backup.rb +++ b/config/backup.rb @@ -24,7 +24,7 @@ Backup::Model.new(:GS5, 'GS5 backup') do db.host = "localhost" db.port = 3306 db.socket = "/var/run/mysqld/mysqld.sock" - db.skip_tables = ["backup_jobs", "restore_jobs"] + db.skip_tables = ["backup_jobs", "restore_jobs", "fax_thumbnails"] end ## @@ -32,7 +32,23 @@ Backup::Model.new(:GS5, 'GS5 backup') do # if File.exists?('/var/opt/gemeinschaft/fax') archive :faxes do |archive| - archive.add '/var/opt/gemeinschaft/fax' + # Incoming faxes + # + Dir.glob("/var/opt/gemeinschaft/fax/in/**/*.pdf").each do |fax_file| + archive.add(fax_file) + end + Dir.glob("/var/opt/gemeinschaft/fax/in/**/*.tiff").each do |fax_file| + archive.add(fax_file) + end + + # Outgoing faxes + # + Dir.glob("/var/opt/gemeinschaft/fax/out/**/*.pdf").each do |fax_file| + archive.add(fax_file) + end + Dir.glob("/var/opt/gemeinschaft/fax/out/**/*.tiff").each do |fax_file| + archive.add(fax_file) + end end end @@ -56,6 +72,4 @@ Backup::Model.new(:GS5, 'GS5 backup') do # Gzip [Compressor] # compress_with Gzip - -end - +end
\ No newline at end of file diff --git a/config/locales/views/restore_jobs/de.yml b/config/locales/views/restore_jobs/de.yml index 18ee349..3fdd72c 100644 --- a/config/locales/views/restore_jobs/de.yml +++ b/config/locales/views/restore_jobs/de.yml @@ -26,7 +26,7 @@ de: edit: 'Bearbeiten' view_all: 'Alle anzeigen' new: - page_title: 'Restore Auftrag neu anlegen' + page_title: 'Restore von einem Backup' actions: back_to_list: 'Zurück zur Übersicht' edit: diff --git a/config/locales/views/restore_jobs/en.yml b/config/locales/views/restore_jobs/en.yml index d75de95..636c335 100644 --- a/config/locales/views/restore_jobs/en.yml +++ b/config/locales/views/restore_jobs/en.yml @@ -26,7 +26,7 @@ en: edit: 'Edit' view_all: 'View All' new: - page_title: 'New Restorejob' + page_title: 'Restore from a backup' actions: back_to_list: 'Back to Index' edit: diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake index 8e55be2..21b0fac 100644 --- a/lib/tasks/backup.rake +++ b/lib/tasks/backup.rake @@ -23,7 +23,11 @@ namespace :backup do # Restore voicemails # - # system "cd / && sudo /bin/tar xzfP #{restore_directory}/GS5/archives/voicemails.tar.gz" + system "cd / && sudo /bin/tar xzfP #{restore_directory}/GS5/archives/voicemails.tar.gz" + + # Delete the archive tar.gz to get more air to breathe + # + FileUtils.mkdir_p "#{restore_directory}/GS5/archives" # Restore the database # @@ -38,6 +42,16 @@ namespace :backup do FileUtils.rm_rf tmp_dir system "cd /opt/gemeinschaft && rake db:migrate" + + # Rebuild the thumbnails + # + FaxDocument.all.each do |fax_document| + fax_document.render_thumbnails + end + + # Delete the restore_job. No need to waste that space. + # + restore_job.destroy end end |