Class: Jpi::V1::AppInstancesController

Inherits:
BaseResourceController
  • Object
show all
Defined in:
app/controllers/mno_enterprise/jpi/v1/app_instances_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /mnoe/jpi/v1/app_instances/1



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/mno_enterprise/jpi/v1/app_instances_controller.rb', line 12

def destroy
  app_instance = MnoEnterprise::AppInstance.find(params[:id])

  if app_instance
    authorize! :manage_app_instances, app_instance.owner
    MnoEnterprise::EventLogger.info('app_destroy', current_user.id, "App destroyed", app_instance.name,app_instance)
    app_instance.terminate
  end
  
  head :accepted
end

#indexObject

GET /mnoe/jpi/v1/organization/1/apps.json?timestamp=151452452345



5
6
7
8
9
# File 'app/controllers/mno_enterprise/jpi/v1/app_instances_controller.rb', line 5

def index
  @app_instances = parent_organization.app_instances.select do |i| 
    i.active? && i.updated_at > Time.at(timestamp) && can?(:access,i)
  end
end