trabajo-afectivo/app/controllers/packages_controller.rb

30 lines
678 B
Ruby
Raw Normal View History

2014-02-03 19:24:49 +00:00
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
2012-12-27 20:17:33 +00:00
class PackagesController < ApplicationController
before_action { authentication_check(permission: 'admin.package') }
2012-12-27 20:17:33 +00:00
# GET /api/v1/packages
2012-12-27 20:17:33 +00:00
def index
2014-05-20 20:19:19 +00:00
packages = Package.all().order('name')
render json: {
packages: packages
2012-12-27 20:17:33 +00:00
}
end
# POST /api/v1/packages
def install
Package.install(string: params[:file_upload].read)
2013-09-22 22:28:33 +00:00
redirect_to '/#system/package'
end
# DELETE /api/v1/packages
def uninstall
package = Package.find(params[:id])
Package.uninstall(name: package.name, version: package.version)
render json: {
success: true
2012-12-27 20:17:33 +00:00
}
end
end