Sha256: 8ff1ac886eb23b62b3e921a49ddb9993718ae931e8b7a4782060c82d38d3d063
Contents?: true
Size: 808 Bytes
Versions: 2
Compression:
Stored size: 808 Bytes
Contents
# frozen_string_literal: true module Api module V2 module ApiAuthorizer extend ActiveSupport::Concern included do before_action :hosts_permission end private def hosts_permission return if User.current.can?('view_hosts') render_error 'access_denied', status: :forbidden, locals: { details: N_('Missing one of the required permissions: view_hosts'), missing_permissions: 'view_hosts' } end def resource_scope(_options = {}) @resource_scope ||= begin scope = PreupgradeReport.joins(:host).merge(Host.authorized(:view_hosts, Host)) scope = scope.where(job_invocation_id: params[:id]) if action_name == 'job_invocation' scope end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman_leapp-2.0.3 | app/controllers/concerns/api/v2/api_authorizer.rb |
foreman_leapp-2.0.2 | app/controllers/concerns/api/v2/api_authorizer.rb |