Merge branch 'develop' of github.com:martini/zammad into develop

This commit is contained in:
Martin Edenhofer 2016-11-30 11:34:01 +01:00
commit 64b56c6d95
33 changed files with 61 additions and 61 deletions

View file

@ -2,7 +2,7 @@ class Index extends App.ControllerContent
events: events:
'click [data-type=network-new]': 'network_new' 'click [data-type=network-new]': 'network_new'
'click [data-type=network-edit]': 'network_edit' 'click [data-type=network-edit]': 'network_edit'
'click [data-type=network-destroy]': 'network_destory' 'click [data-type=network-destroy]': 'network_destroy'
'click [data-type=network-category-new]': 'network_category_new' 'click [data-type=network-category-new]': 'network_category_new'
'click [data-type=network-category-edit]': 'network_category_edit' 'click [data-type=network-category-edit]': 'network_category_edit'
'click [data-type=network-category-destroy]': 'network_category_destroy' 'click [data-type=network-category-destroy]': 'network_category_destroy'
@ -52,7 +52,7 @@ class Index extends App.ControllerContent
@render() @render()
) )
network_destory: (e) -> network_destroy: (e) ->
e.preventDefault() e.preventDefault()
id = $(e.target).parents('[data-id]').data('id') id = $(e.target).parents('[data-id]').data('id')
item = App.Network.find(id) item = App.Network.find(id)

View file

@ -544,7 +544,7 @@ class _taskManagerSingleton extends App.Controller
) )
return return
# destory task in backend # destroy task in backend
delete @tasksToUpdate[ task.key ] delete @tasksToUpdate[ task.key ]
# if task isnt already stored on backend # if task isnt already stored on backend

View file

@ -561,13 +561,13 @@ class ApplicationController < ActionController::Base
render json: generic_object.attributes_with_associations, status: :ok render json: generic_object.attributes_with_associations, status: :ok
end end
def model_destory_render(object, params) def model_destroy_render(object, params)
generic_object = object.find(params[:id]) generic_object = object.find(params[:id])
generic_object.destroy! generic_object.destroy!
model_destory_render_item() model_destroy_render_item()
end end
def model_destory_render_item () def model_destroy_render_item ()
render json: {}, status: :ok render json: {}, status: :ok
end end

View file

@ -36,7 +36,7 @@ class CalendarsController < ApplicationController
end end
def destroy def destroy
model_destory_render(Calendar, params) model_destroy_render(Calendar, params)
end end
end end

View file

@ -42,7 +42,7 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
def destroy def destroy
permission_check('admin') permission_check('admin')
check_access check_access
model_destory_render(Channel, params) model_destroy_render(Channel, params)
end end
def twitter_index def twitter_index

View file

@ -31,7 +31,7 @@ class ChatsController < ApplicationController
end end
def destroy def destroy
model_destory_render(Chat, params) model_destroy_render(Chat, params)
end end
end end

View file

@ -149,6 +149,6 @@ curl http://localhost/api/v1/email_addresses/#{id}.json -v -u #{login}:#{passwor
def destroy def destroy
permission_check('admin.channel_email') permission_check('admin.channel_email')
model_destory_render(EmailAddress, params) model_destroy_render(EmailAddress, params)
end end
end end

View file

@ -20,7 +20,7 @@ class ExternalCredentialsController < ApplicationController
end end
def destroy def destroy
model_destory_render(ExternalCredential, params) model_destroy_render(ExternalCredential, params)
end end
def app_verify def app_verify

View file

@ -149,6 +149,6 @@ curl http://localhost/api/v1/groups/{id} -v -u #{login}:#{password} -H "Content-
=end =end
def destroy def destroy
model_destory_render(Group, params) model_destroy_render(Group, params)
end end
end end

View file

@ -20,7 +20,7 @@ class JobsController < ApplicationController
end end
def destroy def destroy
model_destory_render(Job, params) model_destroy_render(Job, params)
end end
end end

View file

@ -150,6 +150,6 @@ curl http://localhost/api/v1/macros.json -v -u #{login}:#{password} -H "Content-
=end =end
def destroy def destroy
model_destory_render(Macro, params) model_destroy_render(Macro, params)
end end
end end

View file

@ -77,7 +77,7 @@ class ObjectManagerAttributesController < ApplicationController
object_lookup_id: object_manager_attribute.object_lookup_id, object_lookup_id: object_manager_attribute.object_lookup_id,
name: object_manager_attribute.name, name: object_manager_attribute.name,
) )
model_destory_render_item model_destroy_render_item
end end
# POST /object_manager_attributes_discard_changes # POST /object_manager_attributes_discard_changes

View file

@ -99,7 +99,7 @@ curl http://localhost/api/v1/online_notifications/{id}.json -v -u #{login}:#{pas
def destroy def destroy
return if !access? return if !access?
model_destory_render(OnlineNotification, params) model_destroy_render(OnlineNotification, params)
end end
=begin =begin

View file

@ -216,7 +216,7 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
def destroy def destroy
permission_check('ticket.agent') permission_check('ticket.agent')
model_references_check(Organization, params) model_references_check(Organization, params)
model_destory_render(Organization, params) model_destroy_render(Organization, params)
end end
# GET /api/v1/organizations/search # GET /api/v1/organizations/search

View file

@ -156,6 +156,6 @@ curl http://localhost/api/v1/overviews/#{id}.json -v -u #{login}:#{password} -H
=end =end
def destroy def destroy
model_destory_render(Overview, params) model_destroy_render(Overview, params)
end end
end end

View file

@ -175,6 +175,6 @@ Test:
=end =end
def destroy def destroy
model_destory_render(PostmasterFilter, params) model_destroy_render(PostmasterFilter, params)
end end
end end

View file

@ -136,7 +136,7 @@ curl http://localhost/api/report_profiles.json -v -u #{login}:#{password} -H "Co
=end =end
def destroy def destroy
model_destory_render(Report::Profile, params) model_destroy_render(Report::Profile, params)
end end
end end

View file

@ -137,6 +137,6 @@ Test:
=end =end
def destroy def destroy
model_destory_render(Role, params) model_destroy_render(Role, params)
end end
end end

View file

@ -143,6 +143,6 @@ Test:
def destroy def destroy
permission_check(['admin.channel_email']) permission_check(['admin.channel_email'])
model_destory_render(Signature, params) model_destroy_render(Signature, params)
end end
end end

View file

@ -164,7 +164,7 @@ curl http://localhost/api/v1/slas.json -v -u #{login}:#{password} -H "Content-Ty
=end =end
def destroy def destroy
model_destory_render(Sla, params) model_destroy_render(Sla, params)
end end
end end

View file

@ -34,7 +34,7 @@ class TaskbarController < ApplicationController
access(taskbar) access(taskbar)
taskbar.destroy taskbar.destroy
model_destory_render_item() model_destroy_render_item()
end end
private private

View file

@ -144,6 +144,6 @@ curl http://localhost/api/v1/templates.json -v -u #{login}:#{password} -H "Conte
def destroy def destroy
permission_check(['admin.template', 'ticket.agent']) permission_check(['admin.template', 'ticket.agent'])
model_destory_render(Template, params) model_destroy_render(Template, params)
end end
end end

View file

@ -150,6 +150,6 @@ curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Co
def destroy def destroy
permission_check('admin.text_module') permission_check('admin.text_module')
model_destory_render(TextModule, params) model_destroy_render(TextModule, params)
end end
end end

View file

@ -31,6 +31,6 @@ class TicketPrioritiesController < ApplicationController
def destroy def destroy
permission_check('admin.object') permission_check('admin.object')
model_references_check(Ticket::Priority, params) model_references_check(Ticket::Priority, params)
model_destory_render(Ticket::Priority, params) model_destroy_render(Ticket::Priority, params)
end end
end end

View file

@ -31,6 +31,6 @@ class TicketStatesController < ApplicationController
def destroy def destroy
permission_check('admin.object') permission_check('admin.object')
return if model_references_check(Ticket::State, params) return if model_references_check(Ticket::State, params)
model_destory_render(Ticket::State, params) model_destroy_render(Ticket::State, params)
end end
end end

View file

@ -66,6 +66,6 @@ class TranslationsController < ApplicationController
# DELETE /translations/1 # DELETE /translations/1
def destroy def destroy
permission_check('admin.translation') permission_check('admin.translation')
model_destory_render(Translation, params) model_destroy_render(Translation, params)
end end
end end

View file

@ -20,7 +20,7 @@ class TriggersController < ApplicationController
end end
def destroy def destroy
model_destory_render(Trigger, params) model_destroy_render(Trigger, params)
end end
end end

View file

@ -303,7 +303,7 @@ class UsersController < ApplicationController
def destroy def destroy
permission_check('admin.user') permission_check('admin.user')
model_references_check(User, params) model_references_check(User, params)
model_destory_render(User, params) model_destroy_render(User, params)
end end
# @path [GET] /users/me # @path [GET] /users/me

View file

@ -1591,7 +1591,7 @@ check string/varchar size and cut them if needed
=begin =begin
destory object dependencies, will be executed automatically destroy object dependencies, will be executed automatically
=end =end

View file

@ -46,9 +46,9 @@ returns
file.write content file.write content
} }
# destory old session if needed # destroy old session if needed
if File.exist?(path) if File.exist?(path)
Sessions.destory(client_id) Sessions.destroy(client_id)
end end
# move to destination directory # move to destination directory
@ -160,7 +160,7 @@ returns
destroy session destroy session
Sessions.destory(client_id) Sessions.destroy(client_id)
returns returns
@ -168,7 +168,7 @@ returns
=end =end
def self.destory(client_id) def self.destroy(client_id)
path = "#{@path}/#{client_id}" path = "#{@path}/#{client_id}"
FileUtils.rm_rf path FileUtils.rm_rf path
end end
@ -177,7 +177,7 @@ returns
destroy idle session destroy idle session
list_of_client_ids = Sessions.destory_idle_sessions list_of_client_ids = Sessions.destroy_idle_sessions
returns returns
@ -185,13 +185,13 @@ returns
=end =end
def self.destory_idle_sessions(idle_time_in_sec = 240) def self.destroy_idle_sessions(idle_time_in_sec = 240)
list_of_closed_sessions = [] list_of_closed_sessions = []
clients = Sessions.list clients = Sessions.list
clients.each { |client_id, client| clients.each { |client_id, client|
if !client[:meta] || !client[:meta][:last_ping] || ( client[:meta][:last_ping].to_i + idle_time_in_sec ) < Time.now.utc.to_i if !client[:meta] || !client[:meta][:last_ping] || ( client[:meta][:last_ping].to_i + idle_time_in_sec ) < Time.now.utc.to_i
list_of_closed_sessions.push client_id list_of_closed_sessions.push client_id
Sessions.destory(client_id) Sessions.destroy(client_id)
end end
} }
list_of_closed_sessions list_of_closed_sessions
@ -248,14 +248,14 @@ returns
# if no session dir exists, session got destoried # if no session dir exists, session got destoried
if !File.exist? session_dir if !File.exist? session_dir
destory(client_id) destroy(client_id)
log('debug', "missing session directory for '#{client_id}', remove session.") log('debug', "missing session directory for '#{client_id}', remove session.")
return return
end end
# if only session file is missing, then it's an error behavior # if only session file is missing, then it's an error behavior
if !File.exist? session_file if !File.exist? session_file
destory(client_id) destroy(client_id)
log('error', "missing session file for '#{client_id}', remove session.") log('error', "missing session file for '#{client_id}', remove session.")
return return
end end
@ -272,7 +272,7 @@ returns
} }
rescue => e rescue => e
log('error', e.inspect) log('error', e.inspect)
destory(client_id) destroy(client_id)
log('error', "error in reading/parsing session file '#{session_file}', remove session.") log('error', "error in reading/parsing session file '#{session_file}', remove session.")
return return
end end

View file

@ -128,7 +128,7 @@ EventMachine.run {
@clients.delete client_id @clients.delete client_id
end end
Sessions.destory(client_id) Sessions.destroy(client_id)
} }
# manage messages # manage messages
@ -277,7 +277,7 @@ EventMachine.run {
} }
# close unused ajax long polling sessions # close unused ajax long polling sessions
clients = Sessions.destory_idle_sessions(idle_time_in_sec) clients = Sessions.destroy_idle_sessions(idle_time_in_sec)
clients.each { |client_id| clients.each { |client_id|
log 'notice', 'closing idle long polling connection', client_id log 'notice', 'closing idle long polling connection', client_id
} }

View file

@ -98,7 +98,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert_equal(data[:user]['id'], agent1.id, 'check if user id is correct') assert_equal(data[:user]['id'], agent1.id, 'check if user id is correct')
# destroy session # destroy session
Sessions.destory(client_id1) Sessions.destroy(client_id1)
# check if session exists # check if session exists
assert(!Sessions.session_exists?(client_id1), 'check if session exists') assert(!Sessions.session_exists?(client_id1), 'check if session exists')

View file

@ -50,9 +50,9 @@ class SessionEnhancedTest < ActiveSupport::TestCase
client_id1 = '1234' client_id1 = '1234'
client_id2 = '123456' client_id2 = '123456'
client_id3 = 'abc' client_id3 = 'abc'
Sessions.destory(client_id1) Sessions.destroy(client_id1)
Sessions.destory(client_id2) Sessions.destroy(client_id2)
Sessions.destory(client_id3) Sessions.destroy(client_id3)
Sessions.create(client_id1, agent1.attributes, { type: 'websocket' }) Sessions.create(client_id1, agent1.attributes, { type: 'websocket' })
Sessions.create(client_id2, agent2.attributes, { type: 'ajax' }) Sessions.create(client_id2, agent2.attributes, { type: 'ajax' })
Sessions.create(client_id3, agent3.attributes, { type: 'ajax' }) Sessions.create(client_id3, agent3.attributes, { type: 'ajax' })
@ -64,7 +64,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
# check if session still exists after idle cleanup # check if session still exists after idle cleanup
sleep 1 sleep 1
Sessions.destory_idle_sessions(3) Sessions.destroy_idle_sessions(3)
assert(Sessions.session_exists?(client_id1), 'check if session exists after 1 sec') assert(Sessions.session_exists?(client_id1), 'check if session exists after 1 sec')
assert(Sessions.session_exists?(client_id2), 'check if session exists after 1 sec') assert(Sessions.session_exists?(client_id2), 'check if session exists after 1 sec')
assert(Sessions.session_exists?(client_id3), 'check if session exists after 1 sec') assert(Sessions.session_exists?(client_id3), 'check if session exists after 1 sec')
@ -74,7 +74,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
Sessions.touch(client_id1) Sessions.touch(client_id1)
Sessions.touch(client_id2) Sessions.touch(client_id2)
Sessions.touch(client_id3) Sessions.touch(client_id3)
Sessions.destory_idle_sessions(3) Sessions.destroy_idle_sessions(3)
assert(Sessions.session_exists?(client_id1), 'check if session exists after touch') assert(Sessions.session_exists?(client_id1), 'check if session exists after touch')
assert(Sessions.session_exists?(client_id2), 'check if session exists after touch') assert(Sessions.session_exists?(client_id2), 'check if session exists after touch')
assert(Sessions.session_exists?(client_id3), 'check if session exists after touch') assert(Sessions.session_exists?(client_id3), 'check if session exists after touch')
@ -155,7 +155,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
# check if session still exists after idle cleanup # check if session still exists after idle cleanup
sleep 4 sleep 4
client_ids = Sessions.destory_idle_sessions(3) client_ids = Sessions.destroy_idle_sessions(3)
# check client sessions # check client sessions
assert(!Sessions.session_exists?(client_id1), 'check if session is removed') assert(!Sessions.session_exists?(client_id1), 'check if session is removed')
@ -216,9 +216,9 @@ class SessionEnhancedTest < ActiveSupport::TestCase
client_id1_0 = '1234-1' client_id1_0 = '1234-1'
client_id1_1 = '1234-2' client_id1_1 = '1234-2'
client_id2 = '123456' client_id2 = '123456'
Sessions.destory(client_id1_0) Sessions.destroy(client_id1_0)
Sessions.destory(client_id1_1) Sessions.destroy(client_id1_1)
Sessions.destory(client_id2) Sessions.destroy(client_id2)
# start jobs # start jobs
jobs = Thread.new { jobs = Thread.new {
@ -281,7 +281,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
# check if session still exists after idle cleanup # check if session still exists after idle cleanup
sleep 4 sleep 4
client_ids = Sessions.destory_idle_sessions(3) client_ids = Sessions.destroy_idle_sessions(3)
# check client sessions # check client sessions
assert(!Sessions.session_exists?(client_id1_0), 'check if session is removed') assert(!Sessions.session_exists?(client_id1_0), 'check if session is removed')