trabajo-afectivo/app/controllers/chats_controller.rb

42 lines
897 B
Ruby
Raw Normal View History

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
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
deny_if_not_role(Z_ROLENAME_ADMIN)
2015-11-16 10:44:13 +00:00
model_show_render(Chat, params)
end
def create
deny_if_not_role(Z_ROLENAME_ADMIN)
2015-11-16 10:44:13 +00:00
model_create_render(Chat, params)
end
def update
deny_if_not_role(Z_ROLENAME_ADMIN)
2015-11-16 10:44:13 +00:00
model_update_render(Chat, params)
end
def destroy
deny_if_not_role(Z_ROLENAME_ADMIN)
2015-11-16 10:44:13 +00:00
model_destory_render(Chat, params)
end
end