diff --git a/db/migrate/20120101000001_create_base.rb b/db/migrate/20120101000001_create_base.rb index c73d971e4..e0dc45603 100644 --- a/db/migrate/20120101000001_create_base.rb +++ b/db/migrate/20120101000001_create_base.rb @@ -518,5 +518,84 @@ class CreateBase < ActiveRecord::Migration add_index :delayed_jobs, [:priority, :run_at], name: 'delayed_jobs_priority' + create_table :external_syncs do |t| + t.string :source, limit: 100, null: false + t.string :source_id, limit: 200, null: false + t.string :object, limit: 100, null: false + t.integer :o_id, null: false + t.text :last_payload, limit: 500.kilobytes + 1, null: true + t.timestamps limit: 3, null: false + end + add_index :external_syncs, [:source, :source_id], unique: true + add_index :external_syncs, [:source, :source_id, :object, :o_id], name: 'index_external_syncs_on_source_and_source_id_and_object_o_id' + add_index :external_syncs, [:object, :o_id] + + create_table :cti_logs do |t| + t.string :direction, limit: 20, null: false + t.string :state, limit: 20, null: false + t.string :from, limit: 100, null: false + t.string :from_comment, limit: 250, null: true + t.string :to, limit: 100, null: false + t.string :to_comment, limit: 250, null: true + t.string :call_id, limit: 250, null: false + t.string :comment, limit: 500, null: true + t.timestamp :start, limit: 3, null: true + t.timestamp :end, limit: 3, null: true + t.boolean :done, null: false, default: true + t.text :preferences, limit: 500.kilobytes + 1, null: true + t.timestamps limit: 3, null: false + end + add_index :cti_logs, [:call_id], unique: true + add_index :cti_logs, [:direction] + add_index :cti_logs, [:from] + + create_table :cti_caller_ids do |t| + t.string :caller_id, limit: 100, null: false + t.string :comment, limit: 500, null: true + t.string :level, limit: 100, null: false + t.string :object, limit: 100, null: false + t.integer :o_id, null: false + t.integer :user_id, null: true + t.text :preferences, limit: 500.kilobytes + 1, null: true + t.timestamps limit: 3, null: false + end + add_index :cti_caller_ids, [:caller_id] + add_index :cti_caller_ids, [:caller_id, :level] + add_index :cti_caller_ids, [:caller_id, :user_id] + add_index :cti_caller_ids, [:object, :o_id] + + create_table :stats_stores do |t| + t.references :stats_store_object, null: false + t.integer :o_id, null: false + t.string :key, limit: 250, null: true + t.integer :related_o_id, null: true + t.integer :related_stats_store_object_id, null: true + t.string :data, limit: 2500, null: true + t.integer :created_by_id, null: false + t.timestamps limit: 3, null: false + end + add_index :stats_stores, [:o_id] + add_index :stats_stores, [:key] + add_index :stats_stores, [:stats_store_object_id] + add_index :stats_stores, [:created_by_id] + add_index :stats_stores, [:created_at] + + create_table :http_logs do |t| + t.column :direction, :string, limit: 20, null: false + t.column :facility, :string, limit: 100, null: false + t.column :method, :string, limit: 100, null: false + t.column :url, :string, limit: 255, null: false + t.column :status, :string, limit: 20, null: true + t.column :ip, :string, limit: 50, null: true + t.column :request, :string, limit: 10_000, null: false + t.column :response, :string, limit: 10_000, null: false + t.column :updated_by_id, :integer, null: true + t.column :created_by_id, :integer, null: true + t.timestamps limit: 3, null: false + end + add_index :http_logs, [:facility] + add_index :http_logs, [:created_by_id] + add_index :http_logs, [:created_at] + end end diff --git a/db/migrate/20120101000010_create_ticket.rb b/db/migrate/20120101000010_create_ticket.rb index 57224c875..04aee9bbe 100644 --- a/db/migrate/20120101000010_create_ticket.rb +++ b/db/migrate/20120101000010_create_ticket.rb @@ -231,7 +231,7 @@ class CreateTicket < ActiveRecord::Migration create_table :jobs do |t| t.column :name, :string, limit: 250, null: false - t.column :timeplan, :string, limit: 500, null: false + t.column :timeplan, :string, limit: 1000, null: false t.column :condition, :string, limit: 2500, null: false t.column :perform, :string, limit: 2500, null: false t.column :disable_notification, :boolean, null: false, default: true @@ -445,9 +445,42 @@ class CreateTicket < ActiveRecord::Migration end add_index :report_profiles, [:name], unique: true + create_table :karma_users do |t| + t.integer :user_id, null: false + t.integer :score, null: false + t.string :level, limit: 200, null: false + t.timestamps limit: 3, null: false + end + add_index :karma_users, [:user_id], unique: true + + create_table :karma_activities do |t| + t.string :name, limit: 200, null: false + t.string :description, limit: 200, null: false + t.integer :score, null: false + t.integer :once_ttl, null: false + t.timestamps limit: 3, null: false + end + add_index :karma_activities, [:name], unique: true + + create_table :karma_activity_logs do |t| + t.integer :o_id, null: false + t.integer :object_lookup_id, null: false + t.integer :user_id, null: false + t.integer :activity_id, null: false + t.integer :score, null: false + t.integer :score_total, null: false + t.timestamps limit: 3, null: false + end + add_index :karma_activity_logs, [:user_id] + add_index :karma_activity_logs, [:created_at] + add_index :karma_activity_logs, [:o_id, :object_lookup_id] + end def self.down + drop_table :karma_activity_logs + drop_table :karma_activities + drop_table :karma_users drop_table :report_profiles drop_table :chat_topics drop_table :chat_sessions diff --git a/db/migrate/20150967000001_create_stats_store.rb b/db/migrate/20150967000001_create_stats_store.rb deleted file mode 100644 index da91cc369..000000000 --- a/db/migrate/20150967000001_create_stats_store.rb +++ /dev/null @@ -1,42 +0,0 @@ -class CreateStatsStore < ActiveRecord::Migration - def up - create_table :stats_stores do |t| - t.references :stats_store_object, null: false - t.integer :o_id, null: false - t.string :key, limit: 250, null: true - t.integer :related_o_id, null: true - t.integer :related_stats_store_object_id, null: true - t.string :data, limit: 2500, null: true - t.integer :created_by_id, null: false - t.timestamps limit: 3, null: false - end - add_index :stats_stores, [:o_id] - add_index :stats_stores, [:key] - add_index :stats_stores, [:stats_store_object_id] - add_index :stats_stores, [:created_by_id] - add_index :stats_stores, [:created_at] - - Scheduler.create_or_update( - name: 'Generate user based stats.', - method: 'Stats.generate', - period: 11.minutes, - prio: 2, - active: true, - updated_by_id: 1, - created_by_id: 1, - ) - Scheduler.create_or_update( - name: 'Delete old stats store entries.', - method: 'StatsStore.cleanup', - period: 31.days, - prio: 2, - active: true, - updated_by_id: 1, - created_by_id: 1, - ) - end - - def down - drop_table :stats_stores - end -end diff --git a/db/migrate/20160307000001_only_one_group.rb b/db/migrate/20160307000001_only_one_group.rb deleted file mode 100644 index dc0b7d1fe..000000000 --- a/db/migrate/20160307000001_only_one_group.rb +++ /dev/null @@ -1,199 +0,0 @@ - -class OnlyOneGroup < ActiveRecord::Migration - def up - ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'group_id', - display: 'Group', - data_type: 'select', - data_option: { - default: '', - relation: 'Group', - relation_condition: { access: 'rw' }, - nulloption: true, - multiple: false, - null: false, - translate: false, - only_shown_if_selectable: true, - }, - editable: false, - active: true, - screens: { - create_middle: { - '-all-' => { - null: false, - item_class: 'column', - }, - }, - edit: { - Agent: { - null: false, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 25, - created_by_id: 1, - updated_by_id: 1, - ) - - ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'street', - display: 'Street', - data_type: 'input', - data_option: { - type: 'text', - maxlength: 100, - null: true, - }, - editable: true, - active: false, - screens: { - signup: {}, - invite_agent: {}, - invite_customer: {}, - edit: { - '-all-' => { - null: true, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1100, - created_by_id: 1, - updated_by_id: 1, - ) - - ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'zip', - display: 'Zip', - data_type: 'input', - data_option: { - type: 'text', - maxlength: 100, - null: true, - item_class: 'formGroup--halfSize', - }, - editable: true, - active: false, - screens: { - signup: {}, - invite_agent: {}, - invite_customer: {}, - edit: { - '-all-' => { - null: true, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1200, - created_by_id: 1, - updated_by_id: 1, - ) - - ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'city', - display: 'City', - data_type: 'input', - data_option: { - type: 'text', - maxlength: 100, - null: true, - item_class: 'formGroup--halfSize', - }, - editable: true, - active: false, - screens: { - signup: {}, - invite_agent: {}, - invite_customer: {}, - edit: { - '-all-' => { - null: true, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1300, - created_by_id: 1, - updated_by_id: 1, - ) - - ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'address', - display: 'Address', - data_type: 'textarea', - data_option: { - type: 'text', - maxlength: 500, - null: true, - item_class: 'formGroup--halfSize', - }, - editable: true, - active: true, - screens: { - signup: {}, - invite_agent: {}, - invite_customer: {}, - edit: { - '-all-' => { - null: true, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1350, - created_by_id: 1, - updated_by_id: 1, - ) - - list = [] - User.all { |user| - next if !user.zip.empty? && !user.city.empty? && !user.street.empty? - #next if !user.address.empty? - list.push user - } - list - end - -end diff --git a/db/migrate/20160316000006_renew_triggers.rb b/db/migrate/20160316000006_renew_triggers.rb deleted file mode 100644 index 760d3bdef..000000000 --- a/db/migrate/20160316000006_renew_triggers.rb +++ /dev/null @@ -1,49 +0,0 @@ -class RenewTriggers < ActiveRecord::Migration - def up - drop_table :triggers - create_table :triggers do |t| - t.column :name, :string, limit: 250, null: false - t.column :condition, :string, limit: 2500, null: false - t.column :perform, :string, limit: 2500, null: false - t.column :disable_notification, :boolean, null: false, default: true - t.column :note, :string, limit: 250, null: true - t.column :active, :boolean, null: false, default: true - t.column :updated_by_id, :integer, null: false - t.column :created_by_id, :integer, null: false - t.timestamps limit: 3, null: false - end - add_index :triggers, [:name], unique: true - - drop_table :jobs - create_table :jobs do |t| - t.column :name, :string, limit: 250, null: false - t.column :timeplan, :string, limit: 1000, null: false - t.column :condition, :string, limit: 2500, null: false - t.column :perform, :string, limit: 2500, null: false - t.column :disable_notification, :boolean, null: false, default: true - t.column :last_run_at, :timestamp, null: true - t.column :next_run_at, :timestamp, null: true - t.column :running, :boolean, null: false, default: false - t.column :processed, :integer, null: false, default: 0 - t.column :matching, :integer, null: false, default: 0 - t.column :pid, :string, limit: 250, null: true - t.column :note, :string, limit: 250, null: true - t.column :active, :boolean, null: false, default: false - t.column :updated_by_id, :integer, null: false - t.column :created_by_id, :integer, null: false - t.timestamps limit: 3, null: false - end - add_index :jobs, [:name], unique: true - - Scheduler.create_if_not_exists( - name: 'Execute jobs', - method: 'Job.run', - period: 5 * 60, - prio: 2, - active: true, - updated_by_id: 1, - created_by_id: 1, - ) - - end -end diff --git a/db/migrate/20160417000002_add_http_log.rb b/db/migrate/20160417000002_add_http_log.rb deleted file mode 100644 index 4fb47729f..000000000 --- a/db/migrate/20160417000002_add_http_log.rb +++ /dev/null @@ -1,32 +0,0 @@ -class AddHttpLog < ActiveRecord::Migration - def up - - create_table :http_logs do |t| - t.column :direction, :string, limit: 20, null: false - t.column :facility, :string, limit: 100, null: false - t.column :method, :string, limit: 100, null: false - t.column :url, :string, limit: 255, null: false - t.column :status, :string, limit: 20, null: true - t.column :ip, :string, limit: 50, null: true - t.column :request, :string, limit: 10_000, null: false - t.column :response, :string, limit: 10_000, null: false - t.column :updated_by_id, :integer, null: true - t.column :created_by_id, :integer, null: true - t.timestamps limit: 3, null: false - end - add_index :http_logs, [:facility] - add_index :http_logs, [:created_by_id] - add_index :http_logs, [:created_at] - - Scheduler.create_if_not_exists( - name: 'Cleanup HttpLog', - method: 'HttpLog.cleanup', - period: 24 * 60 * 60, - prio: 2, - active: true, - updated_by_id: 1, - created_by_id: 1, - ) - - end -end diff --git a/db/migrate/20160422000003_create_cti_log.rb b/db/migrate/20160422000003_create_cti_log.rb deleted file mode 100644 index 9f0f5dd63..000000000 --- a/db/migrate/20160422000003_create_cti_log.rb +++ /dev/null @@ -1,58 +0,0 @@ -class CreateCtiLog < ActiveRecord::Migration - def up - create_table :cti_logs do |t| - t.string :direction, limit: 20, null: false - t.string :state, limit: 20, null: false - t.string :from, limit: 100, null: false - t.string :from_comment, limit: 250, null: true - t.string :to, limit: 100, null: false - t.string :to_comment, limit: 250, null: true - t.string :call_id, limit: 250, null: false - t.string :comment, limit: 500, null: true - t.timestamp :start, limit: 3, null: true - t.timestamp :end, limit: 3, null: true - t.boolean :done, null: false, default: true - t.text :preferences, limit: 500.kilobytes + 1, null: true - t.timestamps limit: 3, null: false - end - add_index :cti_logs, [:call_id], unique: true - add_index :cti_logs, [:direction] - add_index :cti_logs, [:from] - - create_table :cti_caller_ids do |t| - t.string :caller_id, limit: 100, null: false - t.string :comment, limit: 500, null: true - t.string :level, limit: 100, null: false - t.string :object, limit: 100, null: false - t.integer :o_id, null: false - t.integer :user_id, null: true - t.text :preferences, limit: 500.kilobytes + 1, null: true - t.timestamps limit: 3, null: false - end - add_index :cti_caller_ids, [:caller_id] - add_index :cti_caller_ids, [:caller_id, :level] - add_index :cti_caller_ids, [:caller_id, :user_id] - add_index :cti_caller_ids, [:object, :o_id] - - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - Role.create_if_not_exists( - name: 'CTI', - note: 'Access to CTI feature.', - updated_by_id: 1, - created_by_id: 1 - ) - - Setting.create_if_not_exists( - title: 'Define transaction backend.', - name: '9100_cti_caller_id_detection', - area: 'Transaction::Backend::Async', - description: 'Define the transaction backend which detects caller ids in objects and store them for cti lookups.', - options: {}, - state: 'Transaction::CtiCallerIdDetection', - frontend: false - ) - - end -end diff --git a/db/migrate/20160424000002_create_external_sync.rb b/db/migrate/20160424000002_create_external_sync.rb deleted file mode 100644 index 566c72035..000000000 --- a/db/migrate/20160424000002_create_external_sync.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateExternalSync < ActiveRecord::Migration - def up - create_table :external_syncs do |t| - t.string :source, limit: 100, null: false - t.string :source_id, limit: 200, null: false - t.string :object, limit: 100, null: false - t.integer :o_id, null: false - t.text :last_payload, limit: 500.kilobytes + 1, null: true - t.timestamps limit: 3, null: false - end - add_index :external_syncs, [:source, :source_id], unique: true - add_index :external_syncs, [:source, :source_id, :object, :o_id], name: 'index_external_syncs_on_source_and_source_id_and_object_o_id' - add_index :external_syncs, [:object, :o_id] - end -end diff --git a/db/migrate/20160501000001_update_transaction.rb b/db/migrate/20160501000001_update_transaction.rb deleted file mode 100644 index c1f6fe4ba..000000000 --- a/db/migrate/20160501000001_update_transaction.rb +++ /dev/null @@ -1,63 +0,0 @@ -class UpdateTransaction < ActiveRecord::Migration - def up - - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - Setting.create_or_update( - title: 'Define sync transaction backend.', - name: '0100_trigger', - area: 'Transaction::Backend::Sync', - description: 'Define the transaction backend to execute triggers.', - options: {}, - state: 'Transaction::Trigger', - frontend: false - ) - Setting.create_or_update( - title: 'Define transaction backend.', - name: '0100_notification', - area: 'Transaction::Backend::Async', - description: 'Define the transaction backend to send agent notifications.', - options: {}, - state: 'Transaction::Notification', - frontend: false - ) - Setting.create_or_update( - title: 'Define transaction backend.', - name: '1000_signature_detection', - area: 'Transaction::Backend::Async', - description: 'Define the transaction backend to detect customers signature in email.', - options: {}, - state: 'Transaction::SignatureDetection', - frontend: false - ) - Setting.create_or_update( - title: 'Define transaction backend.', - name: '6000_slack_webhook', - area: 'Transaction::Backend::Async', - description: 'Define the transaction backend which posts messages to (http://www.slack.com).', - options: {}, - state: 'Transaction::Slack', - frontend: false - ) - Setting.create_or_update( - title: 'Define transaction backend.', - name: '9000_clearbit_enrichment', - area: 'Transaction::Backend::Async', - description: 'Define the transaction backend which will enrich customer and organization informations from (http://www.clearbit.com).', - options: {}, - state: 'Transaction::ClearbitEnrichment', - frontend: false - ) - Setting.create_or_update( - title: 'Define transaction backend.', - name: '9100_cti_caller_id_detection', - area: 'Transaction::Backend::Async', - description: 'Define the transaction backend which detects caller ids in objects and store them for cti lookups.', - options: {}, - state: 'Transaction::CtiCallerIdDetection', - frontend: false - ) - - end -end diff --git a/db/migrate/20160503000002_update_trigger.rb b/db/migrate/20160503000002_update_trigger.rb deleted file mode 100644 index e1e19d39e..000000000 --- a/db/migrate/20160503000002_update_trigger.rb +++ /dev/null @@ -1,92 +0,0 @@ -class UpdateTrigger < ActiveRecord::Migration - def up - - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - Trigger.create_or_update( - name: 'auto reply (on new tickets)', - condition: { - 'ticket.action' => { - 'operator' => 'is', - 'value' => 'create', - }, - 'ticket.state_id' => { - 'operator' => 'is not', - 'value' => Ticket::State.lookup(name: 'closed').id, - }, - 'article.type_id' => { - 'operator' => 'is', - 'value' => [ - Ticket::Article::Type.lookup(name: 'email').id, - Ticket::Article::Type.lookup(name: 'phone').id, - Ticket::Article::Type.lookup(name: 'web').id, - ], - }, - 'article.sender_id' => { - 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, - }, - }, - perform: { - 'notification.email' => { - 'body' => '
Your request (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.
-
-
To provide additional information, please reply to this email or click on the following link: -#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} -
-Your #{config.product_name} Team
-Zammad, your customer support system
', - 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your inquiry (#{ticket.title})', - }, - }, - active: false, - created_by_id: 1, - updated_by_id: 1, - ) - Trigger.create_or_update( - name: 'auto reply (on follow up of tickets)', - condition: { - 'ticket.action' => { - 'operator' => 'is', - 'value' => 'update', - }, - 'article.sender_id' => { - 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, - }, - 'article.type_id' => { - 'operator' => 'is', - 'value' => [ - Ticket::Article::Type.lookup(name: 'email').id, - Ticket::Article::Type.lookup(name: 'phone').id, - Ticket::Article::Type.lookup(name: 'web').id, - ], - }, - }, - perform: { - 'notification.email' => { - 'body' => 'Your follow up for (#{config.ticket_hook}#{ticket.number}) has been received and will be reviewed by our support staff.
-
-
To provide additional information, please reply to this email or click on the following link: -#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} -
-Your #{config.product_name} Team
-Zammad, your customer support system
', - 'recipient' => 'ticket_customer', - 'subject' => 'Thanks for your follow up (#{ticket.title})', - }, - }, - active: false, - created_by_id: 1, - updated_by_id: 1, - ) - - end - -end diff --git a/db/migrate/20160505000001_update_trigger2.rb b/db/migrate/20160505000001_update_trigger2.rb deleted file mode 100644 index f07f74159..000000000 --- a/db/migrate/20160505000001_update_trigger2.rb +++ /dev/null @@ -1,33 +0,0 @@ -class UpdateTrigger2 < ActiveRecord::Migration - def up - - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - trigger = Trigger.find_by(name: 'auto reply (on new tickets)') - return if !trigger - trigger.condition = { - 'ticket.action' => { - 'operator' => 'is', - 'value' => 'create', - }, - 'ticket.state_id' => { - 'operator' => 'is not', - 'value' => Ticket::State.lookup(name: 'closed').id, - }, - 'article.type_id' => { - 'operator' => 'is', - 'value' => [ - Ticket::Article::Type.lookup(name: 'email').id, - Ticket::Article::Type.lookup(name: 'phone').id, - Ticket::Article::Type.lookup(name: 'web').id, - ], - }, - 'article.sender_id' => { - 'operator' => 'is', - 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, - }, - } - trigger.save - end - -end diff --git a/db/migrate/20160506000001_update_setting_placeholder.rb b/db/migrate/20160506000001_update_setting_placeholder.rb deleted file mode 100644 index 24e6a9591..000000000 --- a/db/migrate/20160506000001_update_setting_placeholder.rb +++ /dev/null @@ -1,22 +0,0 @@ -class UpdateSettingPlaceholder < ActiveRecord::Migration - def up - - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - names = %w( - product_name - organization - system_id - fqdn - http_type - ticket_hook - ) - names.each { |name| - setting = Setting.find_by(name: name) - next if !setting - setting.preferences[:placeholder] = true - setting.save - } - end - -end diff --git a/db/migrate/20160506000002_email_ticket_cc_remove.rb b/db/migrate/20160506000002_email_ticket_cc_remove.rb deleted file mode 100644 index d86334dcc..000000000 --- a/db/migrate/20160506000002_email_ticket_cc_remove.rb +++ /dev/null @@ -1,13 +0,0 @@ - -class EmailTicketCcRemove < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - object_lookup_id = ObjectLookup.by_name('Ticket') - record = ObjectManager::Attribute.find_by( - object_lookup_id: object_lookup_id, - name: 'cc', - ) - record.destroy if record - end -end diff --git a/db/migrate/20160506000003_role_group_remove.rb b/db/migrate/20160506000003_role_group_remove.rb deleted file mode 100644 index c767f7095..000000000 --- a/db/migrate/20160506000003_role_group_remove.rb +++ /dev/null @@ -1,57 +0,0 @@ - -class RoleGroupRemove < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - object_lookup_id = ObjectLookup.by_name('User') - record = ObjectManager::Attribute.find_by( - object_lookup_id: object_lookup_id, - name: 'role_ids', - ) - record.destroy if record - record = ObjectManager::Attribute.find_by( - object_lookup_id: object_lookup_id, - name: 'group_ids', - ) - record.destroy if record - - ObjectManager::Attribute.create( - object_lookup_id: ObjectLookup.by_name('User'), - name: 'role_ids', - display: 'Permissions', - data_type: 'user_permission', - data_option: { - null: false, - item_class: 'checkbox', - }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: { - '-all-' => { - null: false, - hideMode: { - rolesSelected: ['Agent'], - rolesNot: ['Customer'], - } - }, - }, - invite_customer: {}, - edit: { - Admin: { - null: true, - }, - }, - view: { - '-all-' => { - shown: false, - }, - }, - }, - position: 1600, - updated_by_id: 1, - created_by_id: 1, - ) - end -end diff --git a/db/migrate/20160509000001_contenteditable_iamges.rb b/db/migrate/20160509000001_contenteditable_iamges.rb deleted file mode 100644 index fc18f69df..000000000 --- a/db/migrate/20160509000001_contenteditable_iamges.rb +++ /dev/null @@ -1,12 +0,0 @@ - -class ContenteditableIamges < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - change_column :text_modules, :content, :text, limit: 10.megabytes + 1, null: false - change_column :signatures, :body, :text, limit: 10.megabytes + 1, null: true - change_column :ticket_articles, :body, :text, limit: 20.megabytes + 1, null: false - change_column :taskbars, :state, :text, limit: 20.megabytes + 1, null: true - end -end diff --git a/db/migrate/20160512000001_update_object_manager.rb b/db/migrate/20160512000001_update_object_manager.rb deleted file mode 100644 index 7ee50c9aa..000000000 --- a/db/migrate/20160512000001_update_object_manager.rb +++ /dev/null @@ -1,302 +0,0 @@ -class UpdateObjectManager < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - add_column :object_manager_attributes, :to_create, :boolean, null: false, default: false - add_column :object_manager_attributes, :to_migrate, :boolean, null: false, default: false - add_column :object_manager_attributes, :to_delete, :boolean, null: false, default: false - ObjectManager::Attribute.reset_column_information - ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'name', - display: 'Name', - data_type: 'input', - data_option: { - type: 'text', - maxlength: 150, - null: false, - }, - editable: false, - active: true, - screens: { - create: { - '-all-' => { - null: false, - }, - }, - edit: { - '-all-' => { - null: false, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 200, - created_by_id: 1, - updated_by_id: 1, - ) - ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'assignment_timeout', - display: 'Assignment Timeout', - data_type: 'integer', - data_option: { - maxlength: 150, - null: true, - note: 'Assignment timeout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.', - min: 0, - max: 999_999, - }, - editable: false, - active: true, - screens: { - create: { - '-all-' => { - null: true, - }, - }, - edit: { - '-all-' => { - null: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 300, - created_by_id: 1, - updated_by_id: 1, - ) - ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'follow_up_possible', - display: 'Follow up possible', - data_type: 'select', - data_option: { - default: 'yes', - options: { - yes: 'yes', - reject: 'reject follow up/do not reopen Ticket', - new_ticket: 'do not reopen Ticket but create new Ticket' - }, - null: false, - note: 'Follow up for closed ticket possible or not.', - translate: true - }, - editable: false, - active: true, - screens: { - create: { - '-all-' => { - null: true, - }, - }, - edit: { - '-all-' => { - null: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 400, - created_by_id: 1, - updated_by_id: 1, - ) - ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'follow_up_assignment', - display: 'Assign Follow Ups', - data_type: 'select', - data_option: { - default: 'yes', - options: { - true: 'yes', - false: 'no', - }, - null: false, - note: 'Assign follow up to latest agent again.', - translate: true - }, - editable: false, - active: true, - screens: { - create: { - '-all-' => { - null: true, - }, - }, - edit: { - '-all-' => { - null: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 500, - created_by_id: 1, - updated_by_id: 1, - ) - ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'email_address_id', - display: 'Email', - data_type: 'select', - data_option: { - default: '', - multiple: false, - null: true, - relation: 'EmailAddress', - nulloption: true, - do_not_log: true, - }, - editable: false, - active: true, - screens: { - create: { - '-all-' => { - null: true, - }, - }, - edit: { - '-all-' => { - null: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 600, - created_by_id: 1, - updated_by_id: 1, - ) - ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'signature_id', - display: 'Signature', - data_type: 'select', - data_option: { - default: '', - multiple: false, - null: true, - relation: 'Signature', - nulloption: true, - do_not_log: true, - }, - editable: false, - active: true, - screens: { - create: { - '-all-' => { - null: true, - }, - }, - edit: { - '-all-' => { - null: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 600, - created_by_id: 1, - updated_by_id: 1, - ) - ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'note', - display: 'Note', - data_type: 'richtext', - data_option: { - type: 'text', - maxlength: 250, - null: true, - note: 'Notes are visible to agents only, never to customers.', - }, - editable: false, - active: true, - screens: { - create: { - '-all-' => { - null: true, - }, - }, - edit: { - '-all-' => { - null: true, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1500, - created_by_id: 1, - updated_by_id: 1, - ) - ObjectManager::Attribute.add( - force: true, - object: 'Group', - name: 'active', - display: 'Active', - data_type: 'active', - data_option: { - null: true, - default: true, - }, - editable: false, - active: true, - screens: { - create: { - '-all-' => { - null: true, - }, - }, - edit: { - Admin: { - null: false, - }, - }, - view: { - '-all-' => { - shown: false, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1800, - created_by_id: 1, - updated_by_id: 1, - ) - - end -end diff --git a/db/migrate/20160527000001_update_setting_no_auto_response.rb b/db/migrate/20160527000001_update_setting_no_auto_response.rb deleted file mode 100644 index c36a9528c..000000000 --- a/db/migrate/20160527000001_update_setting_no_auto_response.rb +++ /dev/null @@ -1,24 +0,0 @@ -class UpdateSettingNoAutoResponse < ActiveRecord::Migration - def up - # can be deleted later, db/seeds.rb already updated - Setting.create_or_update( - title: 'Block Notifications', - name: 'send_no_auto_response_reg_exp', - area: 'Email::Base', - description: 'If this regex matches, no notification will be send by the sender.', - options: { - form: [ - { - display: '', - null: false, - name: 'send_no_auto_response_reg_exp', - tag: 'input', - }, - ], - }, - state: '(mailer-daemon|postmaster|abuse|root|noreply|noreply.+?|no-reply|no-reply.+?)@.+?\..+?', - preferences: { online_service_disable: true }, - frontend: false - ) - end -end diff --git a/db/migrate/20160529000001_update_object_manager2.rb b/db/migrate/20160529000001_update_object_manager2.rb deleted file mode 100644 index 43612d8ce..000000000 --- a/db/migrate/20160529000001_update_object_manager2.rb +++ /dev/null @@ -1,116 +0,0 @@ -class UpdateObjectManager2 < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - add_column :object_manager_attributes, :to_config, :boolean, null: false, default: false - add_column :object_manager_attributes, :data_option_new, :string, limit: 8000, null: true, default: false - - UserInfo.current_user_id = 1 - ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'phone', - display: 'Phone', - data_type: 'input', - data_option: { - type: 'tel', - maxlength: 100, - null: true, - item_class: 'formGroup--halfSize', - }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, - invite_customer: {}, - edit: { - '-all-' => { - null: true, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 600, - ) - - ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'mobile', - display: 'Mobile', - data_type: 'input', - data_option: { - type: 'tel', - maxlength: 100, - null: true, - item_class: 'formGroup--halfSize', - }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, - invite_customer: {}, - edit: { - '-all-' => { - null: true, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 700, - ) - - ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'fax', - display: 'Fax', - data_type: 'input', - data_option: { - type: 'tel', - maxlength: 100, - null: true, - item_class: 'formGroup--halfSize', - }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: {}, - invite_customer: {}, - edit: { - '-all-' => { - null: true, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 800, - ) - - end -end diff --git a/db/migrate/20160550000001_update_maintenance.rb b/db/migrate/20160550000001_update_maintenance.rb deleted file mode 100644 index 5b85401a8..000000000 --- a/db/migrate/20160550000001_update_maintenance.rb +++ /dev/null @@ -1,35 +0,0 @@ -class UpdateMaintenance < ActiveRecord::Migration - def up - # can be deleted later, db/seeds.rb already updated - Setting.create_if_not_exists( - title: 'Maintenance Mode', - name: 'maintenance_mode', - area: 'Core::WebApp', - description: 'Enable or disable the maintenance mode of Zammad. If enabled, all non-administrators get logged out and only administrators can start a new session.', - options: {}, - state: false, - preferences: {}, - frontend: true - ) - Setting.create_if_not_exists( - title: 'Maintenance Login', - name: 'maintenance_login', - area: 'Core::WebApp', - description: 'Put a message on the login page. To change it, click on the text area below and change it inline.', - options: {}, - state: false, - preferences: {}, - frontend: true - ) - Setting.create_if_not_exists( - title: 'Maintenance Login', - name: 'maintenance_login_message', - area: 'Core::WebApp', - description: 'Message for login page.', - options: {}, - state: 'Something about to share. Click here to change.', - preferences: {}, - frontend: true - ) - end -end diff --git a/db/migrate/20160602000001_update_tag.rb b/db/migrate/20160602000001_update_tag.rb deleted file mode 100644 index e303e291d..000000000 --- a/db/migrate/20160602000001_update_tag.rb +++ /dev/null @@ -1,35 +0,0 @@ -class UpdateTag < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - remove_index :tag_items, column: [:name] - add_column :tag_items, :name_downcase, :string, limit: 250 - add_index :tag_items, [:name_downcase] - Tag.reset_column_information - Tag::Item.all.each(&:save) - - Setting.create_if_not_exists( - title: 'New Tags', - name: 'tag_new', - area: 'Web::Base', - description: 'Allow users to crate new tags.', - options: { - form: [ - { - display: '', - null: true, - name: 'tag_new', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - state: true, - frontend: true, - ) - end -end diff --git a/db/migrate/20160621000001_update_setting_password.rb b/db/migrate/20160621000001_update_setting_password.rb deleted file mode 100644 index e8f267b78..000000000 --- a/db/migrate/20160621000001_update_setting_password.rb +++ /dev/null @@ -1,155 +0,0 @@ -class UpdateSettingPassword < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - Setting.create_or_update( - title: 'Ignore Escalation/SLA Information', - name: 'import_ignore_sla', - area: 'Import::Base', - description: 'Ignore Escalation/SLA Information form import system.', - options: { - form: [ - { - display: '', - null: true, - name: 'import_ignore_sla', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - state: false, - frontend: false, - ) - Setting.create_or_update( - title: 'Define searchable models.', - name: 'models_searchable', - area: 'Models::Base', - description: 'Define the models which can be searched for.', - options: {}, - state: [], - frontend: true, - ) - Setting.create_or_update( - title: 'Minimal size', - name: 'password_min_size', - area: 'Security::Password', - description: 'Password need to have at least minimal size of characters.', - options: { - form: [ - { - display: '', - null: true, - name: 'password_min_size', - tag: 'select', - options: { - 4 => ' 4', - 5 => ' 5', - 6 => ' 6', - 7 => ' 7', - 8 => ' 8', - 9 => ' 9', - 10 => '10', - 11 => '11', - 12 => '12', - 13 => '13', - 14 => '14', - 15 => '15', - 16 => '16', - 17 => '17', - 18 => '18', - 19 => '19', - 20 => '20', - }, - }, - ], - }, - state: 6, - frontend: false, - ) - Setting.create_or_update( - title: '2 lower and 2 upper characters', - name: 'password_min_2_lower_2_upper_characters', - area: 'Security::Password', - description: 'Password need to contain 2 lower and 2 upper characters.', - options: { - form: [ - { - display: '', - null: true, - name: 'password_min_2_lower_2_upper_characters', - tag: 'select', - options: { - 1 => 'yes', - 0 => 'no', - }, - }, - ], - }, - state: 0, - frontend: false, - ) - Setting.create_or_update( - title: 'Digit required', - name: 'password_need_digit', - area: 'Security::Password', - description: 'Password need to have at least one digit.', - options: { - form: [ - { - display: 'Needed', - null: true, - name: 'password_need_digit', - tag: 'select', - options: { - 1 => 'yes', - 0 => 'no', - }, - }, - ], - }, - state: 1, - frontend: false, - ) - Setting.create_or_update( - title: 'Maximal failed logins', - name: 'password_max_login_failed', - area: 'Security::Password', - description: 'Maximal failed logins after account is inactive.', - options: { - form: [ - { - display: '', - null: true, - name: 'password_max_login_failed', - tag: 'select', - options: { - 4 => ' 4', - 5 => ' 5', - 6 => ' 6', - 7 => ' 7', - 8 => ' 8', - 9 => ' 9', - 10 => '10', - 11 => '11', - 13 => '13', - 14 => '14', - 15 => '15', - 16 => '16', - 17 => '17', - 18 => '18', - 19 => '19', - 20 => '20', - }, - }, - ], - }, - state: 10, - frontend: false, - ) - end -end diff --git a/db/migrate/20160704000001_add_karma.rb b/db/migrate/20160704000001_add_karma.rb deleted file mode 100644 index 9a1e82bf8..000000000 --- a/db/migrate/20160704000001_add_karma.rb +++ /dev/null @@ -1,162 +0,0 @@ -class AddKarma < ActiveRecord::Migration - def up - - create_table :karma_users do |t| - t.integer :user_id, null: false - t.integer :score, null: false - t.string :level, limit: 200, null: false - t.timestamps limit: 3, null: false - end - add_index :karma_users, [:user_id], unique: true - - create_table :karma_activities do |t| - t.string :name, limit: 200, null: false - t.string :description, limit: 200, null: false - t.integer :score, null: false - t.integer :once_ttl, null: false - t.timestamps limit: 3, null: false - end - add_index :karma_activities, [:name], unique: true - Karma::Activity.create_or_update( - name: 'ticket create', - description: 'You have created a ticket', - score: 10, - once_ttl: 60, - ) - Karma::Activity.create_or_update( - name: 'ticket close', - description: 'You have closed a ticket', - score: 5, - once_ttl: 60, - ) - Karma::Activity.create_or_update( - name: 'ticket answer 1h', - description: 'You have answered a ticket within 1h', - score: 25, - once_ttl: 60, - ) - Karma::Activity.create_or_update( - name: 'ticket answer 2h', - description: 'You have answered a ticket within 2h', - score: 20, - once_ttl: 60, - ) - Karma::Activity.create_or_update( - name: 'ticket answer 12h', - description: 'You have answered a ticket within 12h', - score: 10, - once_ttl: 60, - ) - Karma::Activity.create_or_update( - name: 'ticket answer 24h', - description: 'You have answered a ticket within 24h', - score: 5, - once_ttl: 60, - ) - Karma::Activity.create_or_update( - name: 'ticket pending state', - description: 'Usage of advanced features', - score: 2, - once_ttl: 60, - ) - Karma::Activity.create_or_update( - name: 'ticket escalated', - description: 'You have escalated tickets', - score: -5, - once_ttl: 60 * 60 * 24, - ) - Karma::Activity.create_or_update( - name: 'ticket reminder overdue (+2 days)', - description: 'You have tickets that are over 2 days overdue', - score: -5, - once_ttl: 60 * 60 * 24, - ) - Karma::Activity.create_or_update( - name: 'text module', - description: 'Usage of advanced features', - score: 4, - once_ttl: 60 * 30, - ) - Karma::Activity.create_or_update( - name: 'tagging', - description: 'Usage of advanced features', - score: 4, - once_ttl: 60 * 60 * 4, - ) - - create_table :karma_activity_logs do |t| - t.integer :o_id, null: false - t.integer :object_lookup_id, null: false - t.integer :user_id, null: false - t.integer :activity_id, null: false - t.integer :score, null: false - t.integer :score_total, null: false - t.timestamps limit: 3, null: false - end - add_index :karma_activity_logs, [:user_id] - add_index :karma_activity_logs, [:created_at] - add_index :karma_activity_logs, [:o_id, :object_lookup_id] - - Setting.create_if_not_exists( - title: 'Define transaction backend.', - name: '9200_karma', - area: 'Transaction::Backend::Async', - description: 'Define the transaction backend which creates the karma score.', - options: {}, - state: 'Transaction::Karma', - frontend: false - ) - - Setting.create_if_not_exists( - title: 'Define karma levels.', - name: 'karma_levels', - area: 'Core::Karma', - description: 'Define the karma levels.', - options: {}, - state: [ - { - name: 'Beginner', - start: 0, - end: 499, - }, - { - name: 'Newbie', - start: 500, - end: 1999, - }, - { - name: 'Intermediate', - start: 2000, - end: 4999, - }, - { - name: 'Professional', - start: 5000, - end: 6999, - }, - { - name: 'Expert', - start: 7000, - end: 8999, - }, - { - name: 'Master', - start: 9000, - end: 18_999, - }, - { - name: 'Evangelist', - start: 19_000, - end: 45_999, - }, - { - name: 'Hero', - start: 50_000, - end: nil, - }, - ], - frontend: false - ) - - end -end diff --git a/db/migrate/20160717000001_update_setting_email.rb b/db/migrate/20160717000001_update_setting_email.rb deleted file mode 100644 index e6c152160..000000000 --- a/db/migrate/20160717000001_update_setting_email.rb +++ /dev/null @@ -1,71 +0,0 @@ -class UpdateSettingEmail < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - Setting.create_or_update( - title: 'Ticket Subject Size', - name: 'ticket_subject_size', - area: 'Email::Base', - description: 'Max size of the subjects in an email reply.', - options: { - form: [ - { - display: '', - null: false, - name: 'ticket_subject_size', - tag: 'input', - }, - ], - }, - state: '110', - frontend: false - ) - Setting.create_or_update( - title: 'Ticket Subject Reply', - name: 'ticket_subject_re', - area: 'Email::Base', - description: 'The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.', - options: { - form: [ - { - display: '', - null: true, - name: 'ticket_subject_re', - tag: 'input', - }, - ], - }, - state: 'RE', - frontend: false - ) - - Trigger.create_or_update( - name: 'customer notification (on owner change)', - condition: { - 'ticket.owner_id' => { - 'operator' => 'has changed', - 'pre_condition' => 'current_user.id', - 'value' => '', - 'value_completion' => '', - } - }, - perform: { - 'notification.email' => { - 'body' => 'The owner of ticket (Ticket##{ticket.number}) has changed and is now "#{ticket.owner.firstname} #{ticket.owner.lastname}".
-
-
To provide additional information, please reply to this email or click on the following link: -#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id} -
-Zammad, your customer support system
', - 'recipient' => 'ticket_customer', - 'subject' => 'Owner has changed (#{ticket.title})', - }, - }, - active: false, - created_by_id: 1, - updated_by_id: 1, - ) - end -end diff --git a/db/migrate/20160718000001_update_channel.rb b/db/migrate/20160718000001_update_channel.rb deleted file mode 100644 index a0180867d..000000000 --- a/db/migrate/20160718000001_update_channel.rb +++ /dev/null @@ -1,9 +0,0 @@ - -class UpdateChannel < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - change_column :channels, :options, :text, limit: 500.kilobytes + 1, null: true - end -end diff --git a/db/migrate/20160719000001_update_calendars.rb b/db/migrate/20160719000001_update_calendars.rb deleted file mode 100644 index cf6f206c5..000000000 --- a/db/migrate/20160719000001_update_calendars.rb +++ /dev/null @@ -1,9 +0,0 @@ - -class UpdateCalendars < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - change_column :calendars, :business_hours, :string, limit: 3000, null: true - end -end diff --git a/db/migrate/20160725000001_update_text_module.rb b/db/migrate/20160725000001_update_text_module.rb deleted file mode 100644 index ccb395728..000000000 --- a/db/migrate/20160725000001_update_text_module.rb +++ /dev/null @@ -1,9 +0,0 @@ -class UpdateTextModule < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - add_column :text_modules, :foreign_id, :integer, null: true - - end -end diff --git a/db/migrate/20160727000001_update_setting_api.rb b/db/migrate/20160727000001_update_setting_api.rb deleted file mode 100644 index 43c3f593c..000000000 --- a/db/migrate/20160727000001_update_setting_api.rb +++ /dev/null @@ -1,53 +0,0 @@ -class UpdateSettingApi < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - Setting.create_or_update( - title: 'API Token Access', - name: 'api_token_access', - area: 'API::Base', - description: 'Enable REST API using tokens (not username/email addeess and password). Each user need to create own access tokens in user profile.', - options: { - form: [ - { - display: '', - null: true, - name: 'api_token_access', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - state: true, - frontend: false - ) - Setting.create_or_update( - title: 'API Password Access', - name: 'api_password_access', - area: 'API::Base', - description: 'Enable REST API access using the username/email address and password for the authentication user.', - options: { - form: [ - { - display: '', - null: true, - name: 'api_password_access', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - state: true, - frontend: false - ) - add_column :tokens, :label, :string, limit: 255, null: true - - end -end diff --git a/db/migrate/20160802144900_increase_column_length.rb b/db/migrate/20160802144900_increase_column_length.rb deleted file mode 100644 index eeb8b98dc..000000000 --- a/db/migrate/20160802144900_increase_column_length.rb +++ /dev/null @@ -1,9 +0,0 @@ -class IncreaseColumnLength < ActiveRecord::Migration - def change - change_table(:translations) do |t| - t.change :source, :string, limit: 500, null: false - t.change :target, :string, limit: 500, null: false - t.change :target_initial, :string, limit: 500, null: false - end - end -end diff --git a/db/migrate/20160805000001_add_permission.rb b/db/migrate/20160805000001_add_permission.rb deleted file mode 100644 index abbb211b2..000000000 --- a/db/migrate/20160805000001_add_permission.rb +++ /dev/null @@ -1,377 +0,0 @@ -class AddPermission < ActiveRecord::Migration - def change - - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - create_table :permissions do |t| - t.string :name, limit: 255, null: false - t.string :note, limit: 500, null: true - t.string :preferences, limit: 10_000, null: true - t.timestamps limit: 3, null: false - end - add_index :permissions, [:name], unique: true - - create_table :permissions_roles, id: false do |t| - t.belongs_to :role, index: true - t.belongs_to :permission, index: true - end - - Permission.create_or_update( - name: 'admin', - note: 'Admin Interface', - preferences: {}, - ) - Permission.create_or_update( - name: 'admin.user', - note: 'Manage %s', - preferences: { - translations: ['Users'] - }, - ) - Permission.create_or_update( - name: 'admin.group', - note: 'Manage %s', - preferences: { - translations: ['Groups'] - }, - ) - Permission.create_or_update( - name: 'admin.role', - note: 'Manage %s', - preferences: { - translations: ['Roles'] - }, - ) - Permission.create_or_update( - name: 'admin.organization', - note: 'Manage %s', - preferences: { - translations: ['Organizations'] - }, - ) - Permission.create_or_update( - name: 'admin.overview', - note: 'Manage %s', - preferences: { - translations: ['Overviews'] - }, - ) - Permission.create_or_update( - name: 'admin.text_module', - note: 'Manage %s', - preferences: { - translations: ['Text Modules'] - }, - ) - Permission.create_or_update( - name: 'admin.macro', - note: 'Manage %s', - preferences: { - translations: ['Macros'] - }, - ) - Permission.create_or_update( - name: 'admin.tag', - note: 'Manage %s', - preferences: { - translations: ['Tags'] - }, - ) - Permission.create_or_update( - name: 'admin.calendar', - note: 'Manage %s', - preferences: { - translations: ['Calendar'] - }, - ) - Permission.create_or_update( - name: 'admin.sla', - note: 'Manage %s', - preferences: { - translations: ['SLA'] - }, - ) - Permission.create_or_update( - name: 'admin.scheduler', - note: 'Manage %s', - preferences: { - translations: ['Scheduler'] - }, - ) - Permission.create_or_update( - name: 'admin.report_profile', - note: 'Manage %s', - preferences: { - translations: ['Report Profiles'] - }, - ) - Permission.create_or_update( - name: 'admin.channel_web', - note: 'Manage %s', - preferences: { - translations: ['Channel - Web'] - }, - ) - Permission.create_or_update( - name: 'admin.channel_formular', - note: 'Manage %s', - preferences: { - translations: ['Channel - Formular'] - }, - ) - Permission.create_or_update( - name: 'admin.channel_web', - note: 'Manage %s', - preferences: { - translations: ['Channel - Web'] - }, - ) - Permission.create_or_update( - name: 'admin.channel_email', - note: 'Manage %s', - preferences: { - translations: ['Channel - Email'] - }, - ) - Permission.create_or_update( - name: 'admin.channel_twitter', - note: 'Manage %s', - preferences: { - translations: ['Channel - Twitter'] - }, - ) - Permission.create_or_update( - name: 'admin.channel_facebook', - note: 'Manage %s', - preferences: { - translations: ['Channel - Facebook'] - }, - ) - Permission.create_or_update( - name: 'admin.channel_chat', - note: 'Manage %s', - preferences: { - translations: ['Channel - Chat'] - }, - ) - Permission.create_or_update( - name: 'admin.branding', - note: 'Manage %s', - preferences: { - translations: ['Branding'] - }, - ) - Permission.create_or_update( - name: 'admin.setting_system', - note: 'Manage %s Settings', - preferences: { - translations: ['System'] - }, - ) - Permission.create_or_update( - name: 'admin.security', - note: 'Manage %s Settings', - preferences: { - translations: ['Security'] - }, - ) - Permission.create_or_update( - name: 'admin.ticket', - note: 'Manage %s Settings', - preferences: { - translations: ['Ticket'] - }, - ) - Permission.create_or_update( - name: 'admin.package', - note: 'Manage %s', - preferences: { - translations: ['Packages'] - }, - ) - Permission.create_or_update( - name: 'admin.integration', - note: 'Manage %s', - preferences: { - translations: ['Integrations'] - }, - ) - Permission.create_or_update( - name: 'admin.api', - note: 'Manage %s', - preferences: { - translations: ['API'] - }, - ) - Permission.create_or_update( - name: 'admin.object', - note: 'Manage %s', - preferences: { - translations: ['Objects'] - }, - ) - Permission.create_or_update( - name: 'admin.translation', - note: 'Manage %s', - preferences: { - translations: ['Translations'] - }, - ) - Permission.create_or_update( - name: 'admin.maintenance', - note: 'Manage %s', - preferences: { - translations: ['Maintenance'] - }, - ) - Permission.create_or_update( - name: 'admin.session', - note: 'Manage %s', - preferences: { - translations: ['Sessions'] - }, - ) - Permission.create_or_update( - name: 'user_preferences', - note: 'User Preferences', - preferences: {}, - ) - Permission.create_or_update( - name: 'user_preferences.password', - note: 'Change %s', - preferences: { - translations: ['Password'] - }, - ) - Permission.create_or_update( - name: 'user_preferences.notifications', - note: 'Manage %s', - preferences: { - translations: ['Notifications'], - required: ['ticket.agent'], - }, - ) - Permission.create_or_update( - name: 'user_preferences.access_token', - note: 'Manage %s', - preferences: { - translations: ['Token Access'] - }, - ) - Permission.create_or_update( - name: 'user_preferences.language', - note: 'Change %s', - preferences: { - translations: ['Language'] - }, - ) - Permission.create_or_update( - name: 'user_preferences.linked_accounts', - note: 'Manage %s', - preferences: { - translations: ['Linked Accounts'] - }, - ) - Permission.create_or_update( - name: 'user_preferences.device', - note: 'Manage %s', - preferences: { - translations: ['Devices'] - }, - ) - Permission.create_or_update( - name: 'user_preferences.avatar', - note: 'Manage %s', - preferences: { - translations: ['Avatar'] - }, - ) - Permission.create_or_update( - name: 'user_preferences.calendar', - note: 'Access to %s', - preferences: { - translations: ['Calendars'], - required: ['ticket.agent'], - }, - ) - - Permission.create_or_update( - name: 'report', - note: 'Report Interface', - preferences: {}, - ) - Permission.create_or_update( - name: 'ticket', - note: 'Ticket Interface', - preferences: { - disabled: true - }, - ) - Permission.create_or_update( - name: 'ticket.agent', - note: 'Access to Agent Tickets based on Group Access', - preferences: { - not: ['ticket.customer'], - plugin: ['groups'] - }, - ) - Permission.create_or_update( - name: 'ticket.customer', - note: 'Access to Customer Tickets based on current_user and current_user.organization', - preferences: { - not: ['ticket.agent'], - }, - ) - Permission.create_or_update( - name: 'chat', - note: 'Access to %s', - preferences: { - disabled: true, - translations: ['Chat'] - }, - ) - Permission.create_or_update( - name: 'chat.agent', - note: 'Access to %s', - preferences: { - translations: ['Chat'], - not: ['chat.customer'], - }, - ) - Permission.create_or_update( - name: 'cti', - note: 'CTI', - preferences: { - disabled: true - }, - ) - Permission.create_or_update( - name: 'cti.agent', - note: 'Access to %s', - preferences: { - translations: ['CTI'], - not: ['cti.customer'], - }, - ) - - admin = Role.find_by(name: 'Admin') - admin.permission_grand('user_preferences') - admin.permission_grand('admin') - admin.permission_grand('report') - - agent = Role.find_by(name: 'Agent') - agent.permission_grand('user_preferences') - agent.permission_grand('ticket.agent') - agent.permission_grand('chat.agent') - agent.permission_grand('cti.agent') - - customer = Role.find_by(name: 'Customer') - customer.permission_grand('user_preferences.password') - customer.permission_grand('user_preferences.language') - customer.permission_grand('user_preferences.linked_accounts') - customer.permission_grand('user_preferences.avatar') - customer.permission_grand('ticket.customer') - - end -end diff --git a/db/migrate/20160810000002_update_token.rb b/db/migrate/20160810000002_update_token.rb deleted file mode 100644 index 9ba3d2993..000000000 --- a/db/migrate/20160810000002_update_token.rb +++ /dev/null @@ -1,9 +0,0 @@ - -class UpdateToken < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - add_column :tokens, :preferences, :text, limit: 500.kilobytes + 1, null: true - end -end diff --git a/db/migrate/20160810000003_update_activity_stream.rb b/db/migrate/20160810000003_update_activity_stream.rb deleted file mode 100644 index 36a08e75e..000000000 --- a/db/migrate/20160810000003_update_activity_stream.rb +++ /dev/null @@ -1,37 +0,0 @@ - -class UpdateActivityStream < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - ActivityStream.destroy_all - add_column :activity_streams, :permission_id, :integer, null: true - remove_column :activity_streams, :role_id - - ActivityStream.connection.schema_cache.clear! - ActivityStream.reset_column_information - - Setting.create_or_update( - title: 'sipgate.io integration', - name: 'sipgate_integration', - area: 'Integration::Switch', - description: 'Define if sipgate.io (http://www.sipgate.io) is enabled or not.', - options: { - form: [ - { - display: '', - null: true, - name: 'sipgate_integration', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - state: false, - preferences: { prio: 1, trigger: ['menu:render', 'cti:reload'] }, - frontend: false - ) - end -end diff --git a/db/migrate/20160811000001_update_role.rb b/db/migrate/20160811000001_update_role.rb deleted file mode 100644 index 58a6520a0..000000000 --- a/db/migrate/20160811000001_update_role.rb +++ /dev/null @@ -1,138 +0,0 @@ - -class UpdateRole < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - add_column :roles, :preferences, :text, limit: 500.kilobytes + 1, null: true - add_column :roles, :default_at_signup, :boolean, null: true, default: false - - Role.connection.schema_cache.clear! - Role.reset_column_information - - Role.create_or_update( - id: 1, - name: 'Admin', - note: 'To configure your system.', - preferences: { - not: ['Customer'], - }, - default_at_signup: false, - updated_by_id: 1, - created_by_id: 1 - ) - Role.create_or_update( - id: 2, - name: 'Agent', - note: 'To work on Tickets.', - default_at_signup: false, - preferences: { - not: ['Customer'], - }, - updated_by_id: 1, - created_by_id: 1 - ) - Role.create_or_update( - id: 3, - name: 'Customer', - note: 'People who create Tickets ask for help.', - preferences: { - not: %w(Agent Admin), - }, - default_at_signup: true, - updated_by_id: 1, - created_by_id: 1 - ) - Role.create_or_update( - id: 4, - name: 'Report', - note: 'Access the report area.', - preferences: { - not: ['Customer'], - }, - default_at_signup: false, - created_by_id: 1, - updated_by_id: 1, - ) - - ObjectManager::Attribute.add( - force: true, - object: 'Organization', - name: 'shared', - display: 'Shared organization', - data_type: 'boolean', - data_option: { - null: true, - default: true, - note: 'Customers in the organization can view each other items.', - item_class: 'formGroup--halfSize', - translate: true, - options: { - true: 'yes', - false: 'no', - } - }, - editable: false, - active: true, - screens: { - edit: { - Admin: { - null: false, - }, - }, - view: { - '-all-' => { - shown: true, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1400, - created_by_id: 1, - updated_by_id: 1, - ) - - ObjectManager::Attribute.add( - force: true, - object: 'User', - name: 'role_ids', - display: 'Permissions', - data_type: 'user_permission', - data_option: { - null: false, - item_class: 'checkbox', - }, - editable: false, - active: true, - screens: { - signup: {}, - invite_agent: { - '-all-' => { - null: false, - default: [Role.lookup(name: 'Agent').id], - }, - }, - invite_customer: {}, - edit: { - Admin: { - null: true, - }, - }, - view: { - '-all-' => { - shown: false, - }, - }, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 1600, - created_by_id: 1, - updated_by_id: 1, - ) - - end -end diff --git a/db/migrate/20160815000001_update_setting_auth.rb b/db/migrate/20160815000001_update_setting_auth.rb deleted file mode 100644 index 71e0c830f..000000000 --- a/db/migrate/20160815000001_update_setting_auth.rb +++ /dev/null @@ -1,451 +0,0 @@ - -class UpdateSettingAuth < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - change_column :settings, :preferences, :text, limit: 200.kilobytes + 1, null: true - change_column :settings, :state_current, :text, limit: 200.kilobytes + 1, null: true - - Setting.connection.schema_cache.clear! - Setting.reset_column_information - - Setting.create_if_not_exists( - title: 'Authentication via %s', - name: 'auth_ldap', - area: 'Security::Authentication', - description: 'Enables user authentication via %s.', - preferences: { - title_i18n: ['LDAP'], - description_i18n: ['LDAP'] - }, - state: { - adapter: 'Auth::Ldap', - host: 'localhost', - port: 389, - bind_dn: 'cn=Manager,dc=example,dc=org', - bind_pw: 'example', - uid: 'mail', - base: 'dc=example,dc=org', - always_filter: '', - always_roles: %w(Admin Agent), - always_groups: ['Users'], - sync_params: { - firstname: 'sn', - lastname: 'givenName', - email: 'mail', - login: 'mail', - }, - }, - frontend: false - ) - Setting.create_or_update( - title: 'Authentication via %s', - name: 'auth_twitter', - area: 'Security::ThirdPartyAuthentication', - description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { - form: [ - { - display: '', - null: true, - name: 'auth_twitter', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_twitter_credentials'], - title_i18n: ['Twitter'], - description_i18n: ['Twitter', 'Twitter Developer Site', 'https://dev.twitter.com/apps'] - }, - state: false, - frontend: true - ) - Setting.create_or_update( - title: 'Twitter App Credentials', - name: 'auth_twitter_credentials', - area: 'Security::ThirdPartyAuthentication::Twitter', - description: 'App credentials for Twitter.', - options: { - form: [ - { - display: 'Twitter Key', - null: true, - name: 'key', - tag: 'input', - }, - { - display: 'Twitter Secret', - null: true, - name: 'secret', - tag: 'input', - }, - ], - }, - state: {}, - frontend: false - ) - Setting.create_or_update( - title: 'Authentication via %s', - name: 'auth_facebook', - area: 'Security::ThirdPartyAuthentication', - description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { - form: [ - { - display: '', - null: true, - name: 'auth_facebook', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_facebook_credentials'], - title_i18n: ['Facebook'], - description_i18n: ['Facebook', 'Facebook Developer Site', 'https://developers.facebook.com/apps/'] - }, - state: false, - frontend: true - ) - - Setting.create_or_update( - title: 'Facebook App Credentials', - name: 'auth_facebook_credentials', - area: 'Security::ThirdPartyAuthentication::Facebook', - description: 'App credentials for Facebook.', - options: { - form: [ - { - display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', - }, - { - display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', - }, - ], - }, - state: {}, - frontend: false - ) - - Setting.create_or_update( - title: 'Authentication via %s', - name: 'auth_google_oauth2', - area: 'Security::ThirdPartyAuthentication', - description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { - form: [ - { - display: '', - null: true, - name: 'auth_google_oauth2', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_google_oauth2_credentials'], - title_i18n: ['Google'], - description_i18n: ['Google', 'Google API Console Site', 'https://console.developers.google.com/apis/credentials'] - }, - state: false, - frontend: true - ) - Setting.create_or_update( - title: 'Google App Credentials', - name: 'auth_google_oauth2_credentials', - area: 'Security::ThirdPartyAuthentication::Google', - description: 'Enables user authentication via Google.', - options: { - form: [ - { - display: 'Client ID', - null: true, - name: 'client_id', - tag: 'input', - }, - { - display: 'Client Secret', - null: true, - name: 'client_secret', - tag: 'input', - }, - ], - }, - state: {}, - frontend: false - ) - - Setting.create_or_update( - title: 'Authentication via %s', - name: 'auth_linkedin', - area: 'Security::ThirdPartyAuthentication', - description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { - form: [ - { - display: '', - null: true, - name: 'auth_linkedin', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_linkedin_credentials'], - title_i18n: ['LinkedIn'], - description_i18n: ['LinkedIn', 'Linkedin Developer Site', 'https://www.linkedin.com/developer/apps'] - }, - state: false, - frontend: true - ) - Setting.create_or_update( - title: 'LinkedIn App Credentials', - name: 'auth_linkedin_credentials', - area: 'Security::ThirdPartyAuthentication::Linkedin', - description: 'Enables user authentication via LinkedIn.', - options: { - form: [ - { - display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', - }, - { - display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', - }, - ], - }, - state: {}, - frontend: false - ) - - Setting.create_or_update( - title: 'Authentication via %s', - name: 'auth_github', - area: 'Security::ThirdPartyAuthentication', - description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { - form: [ - { - display: '', - null: true, - name: 'auth_github', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_github_credentials'], - title_i18n: ['Github'], - description_i18n: ['Github', 'Github OAuth Applications', 'https://github.com/settings/applications'] - }, - state: false, - frontend: true - ) - Setting.create_or_update( - title: 'Github App Credentials', - name: 'auth_github_credentials', - area: 'Security::ThirdPartyAuthentication::Github', - description: 'Enables user authentication via Github.', - options: { - form: [ - { - display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', - }, - { - display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', - }, - ], - }, - state: {}, - frontend: false - ) - - Setting.create_or_update( - title: 'Authentication via %s', - name: 'auth_gitlab', - area: 'Security::ThirdPartyAuthentication', - description: 'Enables user authentication via %s. Register your app first at [%s](%s).', - options: { - form: [ - { - display: '', - null: true, - name: 'auth_gitlab', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_gitlab_credentials'], - title_i18n: ['Gitlab'], - description_i18n: ['Gitlab', 'Gitlab Applications', 'https://your-gitlab-host/admin/applications'] - }, - state: false, - frontend: true - ) - Setting.create_or_update( - title: 'Gitlab App Credentials', - name: 'auth_gitlab_credentials', - area: 'Security::ThirdPartyAuthentication::Gitlab', - description: 'Enables user authentication via Gitlab.', - options: { - form: [ - { - display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', - }, - { - display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', - }, - { - display: 'Site', - null: true, - name: 'site', - tag: 'input', - placeholder: 'https://gitlab.YOURDOMAIN.com', - }, - ], - }, - state: {}, - frontend: false - ) - - Setting.create_or_update( - title: 'Authentication via %s', - name: 'auth_oauth2', - area: 'Security::ThirdPartyAuthentication', - description: 'Enables user authentication via Generic OAuth2. Register your app first,', - options: { - form: [ - { - display: '', - null: true, - name: 'auth_oauth2', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - preferences: { - controller: 'SettingsAreaSwitch', - sub: ['auth_oauth2_credentials'], - title_i18n: ['Generic OAuth2'], - }, - state: false, - frontend: true - ) - Setting.create_or_update( - title: 'Generic OAuth2 App Credentials', - name: 'auth_oauth2_credentials', - area: 'Security::ThirdPartyAuthentication::GenericOAuth', - description: 'Enables user authentication via Generic OAuth2.', - options: { - form: [ - { - display: 'Name', - null: true, - name: 'name', - tag: 'input', - placeholder: 'Some Provider Name', - }, - { - display: 'App ID', - null: true, - name: 'app_id', - tag: 'input', - }, - { - display: 'App Secret', - null: true, - name: 'app_secret', - tag: 'input', - }, - { - display: 'Site', - null: true, - name: 'site', - tag: 'input', - placeholder: 'https://gitlab.YOURDOMAIN.com', - }, - { - display: 'authorize_url', - null: true, - name: 'authorize_url', - tag: 'input', - placeholder: '/oauth/authorize', - }, - { - display: 'token_url', - null: true, - name: 'token_url', - tag: 'input', - placeholder: '/oauth/token', - }, - ], - }, - state: {}, - frontend: false - ) - setting = Setting.find_by(name: 'product_logo') - setting.preferences[:controller] = 'SettingsAreaLogo' - setting.save - - end -end diff --git a/db/migrate/20160817000002_update_setting_cti.rb b/db/migrate/20160817000002_update_setting_cti.rb deleted file mode 100644 index 947061525..000000000 --- a/db/migrate/20160817000002_update_setting_cti.rb +++ /dev/null @@ -1,17 +0,0 @@ -class UpdateSettingCti < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - setting = Setting.find_by(name: 'sipgate_integration') - setting.frontend = true - setting.preferences[:authentication] = true - setting.save! - - %w(system_id ticket_hook customer_ticket_create customer_ticket_create_group_ids customer_ticket_view models_searchable tag_new defaults_calendar_subscriptions_tickets).each { |name| - setting = Setting.find_by(name: name) - setting.preferences[:authentication] = true - setting.save! - } - end -end diff --git a/db/migrate/20160819000001_update_setting_postmaster_filter2.rb b/db/migrate/20160819000001_update_setting_postmaster_filter2.rb deleted file mode 100644 index 589698778..000000000 --- a/db/migrate/20160819000001_update_setting_postmaster_filter2.rb +++ /dev/null @@ -1,49 +0,0 @@ -class UpdateSettingPostmasterFilter2 < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - Setting.create_if_not_exists( - title: 'Define postmaster filter.', - name: '0012_postmaster_filter_sender_is_system_address', - area: 'Postmaster::PreFilter', - description: 'Define postmaster filter to check if email got created via email as Zammad.', - options: {}, - state: 'Channel::Filter::SenderIsSystemAddress', - frontend: false - ) - ObjectManager::Attribute.add( - force: true, - object: 'Ticket', - name: 'customer_id', - display: 'Customer', - data_type: 'user_autocompletion', - data_option: { - relation: 'User', - autocapitalize: false, - multiple: false, - guess: true, - null: false, - limit: 200, - placeholder: 'Enter Person or Organization/Company', - minLengt: 2, - translate: false, - }, - editable: false, - active: true, - screens: { - create_top: { - Agent: { - null: false, - }, - }, - edit: {}, - }, - to_create: false, - to_migrate: false, - to_delete: false, - position: 10, - updated_by_id: 1, - created_by_id: 1, - ) - end -end diff --git a/db/migrate/20160826000001_update_setting_permission.rb b/db/migrate/20160826000001_update_setting_permission.rb deleted file mode 100644 index da875fc79..000000000 --- a/db/migrate/20160826000001_update_setting_permission.rb +++ /dev/null @@ -1,462 +0,0 @@ -class UpdateSettingPermission < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - updates = [ - { - name: 'maintenance_mode', - preferences: { - permission: ['admin.maintenance'] - }, - }, - { - name: 'maintenance_login', - preferences: { - permission: ['admin.maintenance'] - }, - }, - { - name: 'maintenance_login_message', - preferences: { - permission: ['admin.maintenance'] - }, - }, - { - name: 'product_name', - preferences: { - permission: ['admin.branding'] - }, - }, - { - name: 'product_logo', - preferences: { - permission: ['admin.branding'] - }, - }, - { - name: 'system_id', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'fqdn', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'http_type', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'storage', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'image_backend', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'geo_ip_backend', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'geo_location_backend', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'geo_calendar_backend', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'ui_send_client_stats', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'ui_client_storage', - preferences: { - permission: ['admin.system'] - }, - }, - { - name: 'user_create_account', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'user_lost_password', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_ldap', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_twitter', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_twitter_credentials', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_facebook', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_facebook_credentials', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_google_oauth2', - preferences: { - permission: ['admin.maintenance'] - }, - }, - { - name: 'maintenance_mode', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_google_oauth2_credentials', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_linkedin', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_linkedin_credentials', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_github', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_github_credentials', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_gitlab', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_gitlab_credentials', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_oauth2', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'auth_oauth2_credentials', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'password_min_size', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'password_min_2_lower_2_upper_characters', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'password_need_digit', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'password_max_login_failed', - preferences: { - permission: ['admin.security'] - }, - }, - { - name: 'ticket_hook', - preferences: { - permission: ['admin.ticket'] - }, - }, - { - name: 'ticket_hook_divider', - preferences: { - permission: ['admin.ticket'] - }, - }, - { - name: 'ticket_hook_position', - preferences: { - permission: ['admin.ticket'] - }, - }, - { - name: 'ticket_number', - preferences: { - permission: ['admin.ticket'] - }, - }, - { - name: 'ticket_number_increment', - preferences: { - permission: ['admin.ticket'] - }, - }, - { - name: 'ticket_number_date', - preferences: { - permission: ['admin.ticket'] - }, - }, - { - name: 'customer_ticket_create', - preferences: { - permission: ['admin.channel_web'] - }, - }, - { - name: 'customer_ticket_create_group_ids', - preferences: { - permission: ['admin.channel_web'] - }, - }, - { - name: 'customer_ticket_view', - preferences: { - permission: ['admin.channel_web'] - }, - }, - { - name: 'form_ticket_create', - preferences: { - permission: ['admin.channel_formular'] - }, - }, - { - name: 'ticket_subject_size', - preferences: { - permission: ['admin.channel_email'] - }, - }, - { - name: 'ticket_subject_re', - preferences: { - permission: ['admin.channel_email'] - }, - }, - { - name: 'ticket_define_email_from', - preferences: { - permission: ['admin.channel_email'] - }, - }, - { - name: 'ticket_define_email_from_seperator', - preferences: { - permission: ['admin.channel_email'] - }, - }, - { - name: 'postmaster_max_size', - preferences: { - permission: ['admin.channel_email'] - }, - }, - { - name: 'postmaster_follow_up_search_in', - preferences: { - permission: ['admin.channel_email'] - }, - }, - { - name: 'notification_sender', - preferences: { - permission: ['admin.channel_email'] - }, - }, - { - name: 'send_no_auto_response_reg_exp', - preferences: { - permission: ['admin.channel_email'] - }, - }, - { - name: 'api_token_access', - preferences: { - permission: ['admin.api'] - }, - }, - { - name: 'api_password_access', - preferences: { - permission: ['admin.api'] - }, - }, - { - name: 'chat', - preferences: { - permission: ['admin.channel_chat'] - }, - }, - { - name: 'chat_agent_idle_timeout', - preferences: { - permission: ['admin.channel_chat'] - }, - }, - { - name: 'tag_new', - preferences: { - permission: ['admin.tag'] - }, - }, - { - name: 'icinga_integration', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'icinga_sender', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'icinga_auto_close', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'icinga_auto_close_state_id', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'nagios_integration', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'nagios_sender', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'nagios_auto_close', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'nagios_auto_close_state_id', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'slack_integration', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'slack_config', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'sipgate_integration', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'sipgate_config', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'clearbit_integration', - preferences: { - permission: ['admin.integration'] - }, - }, - { - name: 'clearbit_config', - preferences: { - permission: ['admin.integration'] - }, - }, - ] - - updates.each { |item| - setting = Setting.find_by(name: item[:name]) - item[:preferences].each { |key, value| - setting.preferences[key] = value - } - setting.save! - } - - end -end diff --git a/db/migrate/20160830000001_token_attributes.rb b/db/migrate/20160830000001_token_attributes.rb deleted file mode 100644 index ea8f89eeb..000000000 --- a/db/migrate/20160830000001_token_attributes.rb +++ /dev/null @@ -1,9 +0,0 @@ -class TokenAttributes < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - add_column :tokens, :last_used_at, :timestamp, limit: 3, null: true - add_column :tokens, :expires_at, :date, null: true - end -end diff --git a/db/migrate/20160913000002_ticket_rename.rb b/db/migrate/20160913000002_ticket_rename.rb deleted file mode 100644 index 836d7f3eb..000000000 --- a/db/migrate/20160913000002_ticket_rename.rb +++ /dev/null @@ -1,54 +0,0 @@ -class TicketRename < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - rename_column :tickets, :first_response, :first_response_at - rename_column :tickets, :first_response_escal_date, :first_response_escalation_at - - rename_column :tickets, :close_time, :close_at - rename_column :tickets, :close_time_escal_date, :close_escalation_at - rename_column :tickets, :close_time_in_min, :close_in_min - rename_column :tickets, :close_time_diff_in_min, :close_diff_in_min - - rename_column :tickets, :update_time_escal_date, :update_escalation_at - rename_column :tickets, :update_time_in_min, :update_in_min - rename_column :tickets, :update_time_diff_in_min, :update_diff_in_min - - rename_column :tickets, :escalation_time, :escalation_at - - rename_column :tickets, :last_contact, :last_contact_at - rename_column :tickets, :last_contact_agent, :last_contact_agent_at - rename_column :tickets, :last_contact_customer, :last_contact_customer_at - - remove_column :tickets, :first_response_sla_time - remove_column :tickets, :close_time_sla_time - remove_column :tickets, :update_time_sla_time - - overview_role = Role.find_by(name: 'Agent') - Overview.create_or_update( - name: 'Escalated', - link: 'all_escalated', - prio: 1050, - role_id: overview_role.id, - condition: { - 'ticket.escalation_at' => { - operator: 'within next (relative)', - value: '10', - range: 'minute', - }, - }, - order: { - by: 'escalation_at', - direction: 'ASC', - }, - view: { - d: %w(title customer group owner escalation_at), - s: %w(title customer group owner escalation_at), - m: %w(number title customer group owner escalation_at), - view_mode_default: 's', - }, - ) - - end -end diff --git a/db/migrate/20160919000001_template_update.rb b/db/migrate/20160919000001_template_update.rb deleted file mode 100644 index e8118c720..000000000 --- a/db/migrate/20160919000001_template_update.rb +++ /dev/null @@ -1,9 +0,0 @@ - -class TemplateUpdate < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - change_column :templates, :options, :text, limit: 10.megabytes + 1, null: true - end -end diff --git a/db/migrate/20160920000001_user_preferences_update.rb b/db/migrate/20160920000001_user_preferences_update.rb deleted file mode 100644 index 87a161d9e..000000000 --- a/db/migrate/20160920000001_user_preferences_update.rb +++ /dev/null @@ -1,9 +0,0 @@ - -class UserPreferencesUpdate < ActiveRecord::Migration - def up - # return if it's a new setup - return if !Setting.find_by(name: 'system_init_done') - - User.update_default_preferences_by_permission('ticket.agent') - end -end diff --git a/db/seeds.rb b/db/seeds.rb index 8cdf2fd26..f6b45fe40 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -407,7 +407,7 @@ Setting.create_if_not_exists( }, ], }, - state: true, + state: false, preferences: { prio: 1, permission: ['admin.system'], @@ -1324,33 +1324,6 @@ Setting.create_if_not_exists( frontend: true ) -Setting.create_if_not_exists( - title: 'Enable Ticket View/Update', - name: 'customer_ticket_view', - area: 'CustomerWeb::Base', - description: 'Defines if a customer view and update his own tickets.', - options: { - form: [ - { - display: '', - null: true, - name: 'customer_ticket_view', - tag: 'boolean', - options: { - true => 'yes', - false => 'no', - }, - }, - ], - }, - state: true, - preferences: { - authentication: true, - permission: ['admin.channel_web'], - }, - frontend: true -) - Setting.create_if_not_exists( title: 'Enable Ticket creation', name: 'form_ticket_create', @@ -3057,12 +3030,12 @@ Ticket::Article.create( Thank you for choosing Zammad. You will find updates and patches at http://zammad.org/. Online -documentation is available at http://guides.zammad.org/. You can also -use our forums at http://forums.zammad.org/ +documentation is available at http://zammad.org/documentation. Get +involved (discussions, contributing, ...) at http://zammad.org/participate. Regards, -The Zammad Project +Your Zammad Team ', internal: false, ) @@ -5158,6 +5131,33 @@ Scheduler.create_or_update( updated_by_id: 1, created_by_id: 1, ) +Scheduler.create_or_update( + name: 'Generate user based stats.', + method: 'Stats.generate', + period: 11.minutes, + prio: 2, + active: true, + updated_by_id: 1, + created_by_id: 1, +) +Scheduler.create_or_update( + name: 'Delete old stats store entries.', + method: 'StatsStore.cleanup', + period: 31.days, + prio: 2, + active: true, + updated_by_id: 1, + created_by_id: 1, +) +Scheduler.create_if_not_exists( + name: 'Cleanup HttpLog', + method: 'HttpLog.cleanup', + period: 24 * 60 * 60, + prio: 2, + active: true, + updated_by_id: 1, + created_by_id: 1, +) Trigger.create_or_update( name: 'auto reply (on new tickets)', @@ -5270,6 +5270,73 @@ Trigger.create_or_update( updated_by_id: 1, ) +Karma::Activity.create_or_update( + name: 'ticket create', + description: 'You have created a ticket', + score: 10, + once_ttl: 60, +) +Karma::Activity.create_or_update( + name: 'ticket close', + description: 'You have closed a ticket', + score: 5, + once_ttl: 60, +) +Karma::Activity.create_or_update( + name: 'ticket answer 1h', + description: 'You have answered a ticket within 1h', + score: 25, + once_ttl: 60, +) +Karma::Activity.create_or_update( + name: 'ticket answer 2h', + description: 'You have answered a ticket within 2h', + score: 20, + once_ttl: 60, +) +Karma::Activity.create_or_update( + name: 'ticket answer 12h', + description: 'You have answered a ticket within 12h', + score: 10, + once_ttl: 60, +) +Karma::Activity.create_or_update( + name: 'ticket answer 24h', + description: 'You have answered a ticket within 24h', + score: 5, + once_ttl: 60, +) +Karma::Activity.create_or_update( + name: 'ticket pending state', + description: 'Usage of advanced features', + score: 2, + once_ttl: 60, +) +Karma::Activity.create_or_update( + name: 'ticket escalated', + description: 'You have escalated tickets', + score: -5, + once_ttl: 60 * 60 * 24, +) +Karma::Activity.create_or_update( + name: 'ticket reminder overdue (+2 days)', + description: 'You have tickets that are over 2 days overdue', + score: -5, + once_ttl: 60 * 60 * 24, +) +Karma::Activity.create_or_update( + name: 'text module', + description: 'Usage of advanced features', + score: 4, + once_ttl: 60 * 30, +) +Karma::Activity.create_or_update( + name: 'tagging', + description: 'Usage of advanced features', + score: 4, + once_ttl: 60 * 60 * 4, +) + # reset primary key sequences if ActiveRecord::Base.connection_config[:adapter] == 'postgresql' ActiveRecord::Base.connection.tables.each do |t|