Class: Katello::Api::V2::SimpleContentAccessController

Inherits:
ApiController
  • Object
show all
Defined in:
app/controllers/katello/api/v2/simple_content_access_controller.rb

Instance Method Summary collapse

Methods inherited from ApiController

#check_katello_agent_not_disabled, #deprecate_katello_agent, #empty_search_query?, #full_result_response, #katello_agent_removal_release, #resource_class, #scoped_search, #skip_session

Methods included from Rendering

#respond_for_async, #respond_for_bulk_async, #respond_for_create, #respond_for_destroy, #respond_for_index, #respond_for_show, #respond_for_status, #respond_for_update, #respond_with_template, #respond_with_template_collection, #respond_with_template_resource, #try_specific_collection_template, #try_specific_resource_template

Methods included from Katello::Api::Version2

#api_version

Instance Method Details

#disableObject



39
40
41
42
# File 'app/controllers/katello/api/v2/simple_content_access_controller.rb', line 39

def disable
  task = async_task(::Actions::Katello::Organization::SimpleContentAccess::Disable, params[:organization_id])
  respond_for_async :resource => task
end

#eligibleObject



12
13
14
15
16
# File 'app/controllers/katello/api/v2/simple_content_access_controller.rb', line 12

def eligible
  ::Foreman::Deprecation.api_deprecation_warning("This endpoint is deprecated and will be removed in a future release. All organizations are now eligible for Simple Content Access.")
  eligible = @organization.simple_content_access_eligible?
  render json: { simple_content_access_eligible: eligible }
end

#enableObject



30
31
32
33
34
# File 'app/controllers/katello/api/v2/simple_content_access_controller.rb', line 30

def enable
  auto_create = params.key?(:auto_create_overrides) ? ::Foreman::Cast.to_bool(params[:auto_create_overrides]) : true
  task = async_task(::Actions::Katello::Organization::SimpleContentAccess::Enable, params[:organization_id], auto_create_overrides: auto_create)
  respond_for_async :resource => task
end

#statusObject



21
22
23
24
# File 'app/controllers/katello/api/v2/simple_content_access_controller.rb', line 21

def status
  status = @organization.simple_content_access?
  render json: { simple_content_access: status }
end