trabajo-afectivo/app/controllers/packages_controller.rb

38 lines
786 B
Ruby
Raw Normal View History

# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
2012-12-27 20:17:33 +00:00
class PackagesController < ApplicationController
before_filter :authentication_check
# GET /api/packages
def index
2013-07-19 14:21:44 +00:00
return if deny_if_not_role('Admin')
packages = Package.all( :order => 'name' )
2012-12-27 20:17:33 +00:00
render :json => {
:packages => packages
}
end
# POST /api/packages
def install
2013-07-19 14:21:44 +00:00
return if deny_if_not_role('Admin')
2012-12-27 20:17:33 +00:00
Package.install( :string => params[:file_upload].read )
redirect_to '/#package'
end
# DELETE /api/packages
def uninstall
2013-07-19 14:21:44 +00:00
return if deny_if_not_role('Admin')
package = Package.find( params[:id] )
Package.uninstall( :name => package.name, :version => package.version )
2012-12-27 20:17:33 +00:00
render :json => {
:success => true
2012-12-27 20:17:33 +00:00
}
end
end