2015-11-16 10:44:13 +00:00
|
|
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
|
|
|
class ChatsController < ApplicationController
|
|
|
|
before_action :authentication_check
|
|
|
|
|
|
|
|
def index
|
2016-06-30 08:24:03 +00:00
|
|
|
deny_if_not_role(Z_ROLENAME_ADMIN)
|
2015-11-16 10:44:13 +00:00
|
|
|
chat_ids = []
|
|
|
|
assets = {}
|
|
|
|
Chat.order(:id).each {|chat|
|
|
|
|
chat_ids.push chat.id
|
|
|
|
assets = chat.assets(assets)
|
|
|
|
}
|
2015-11-25 22:24:08 +00:00
|
|
|
setting = Setting.find_by(name: 'chat')
|
|
|
|
assets = setting.assets(assets)
|
2015-11-16 10:44:13 +00:00
|
|
|
render json: {
|
|
|
|
chat_ids: chat_ids,
|
|
|
|
assets: assets,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2016-06-30 08:24:03 +00:00
|
|
|
deny_if_not_role(Z_ROLENAME_ADMIN)
|
2015-11-16 10:44:13 +00:00
|
|
|
model_show_render(Chat, params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2016-06-30 08:24:03 +00:00
|
|
|
deny_if_not_role(Z_ROLENAME_ADMIN)
|
2015-11-16 10:44:13 +00:00
|
|
|
model_create_render(Chat, params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2016-06-30 08:24:03 +00:00
|
|
|
deny_if_not_role(Z_ROLENAME_ADMIN)
|
2015-11-16 10:44:13 +00:00
|
|
|
model_update_render(Chat, params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2016-06-30 08:24:03 +00:00
|
|
|
deny_if_not_role(Z_ROLENAME_ADMIN)
|
2015-11-16 10:44:13 +00:00
|
|
|
model_destory_render(Chat, params)
|
|
|
|
end
|
|
|
|
end
|