Sha256: d1fc5dc868f4d094d45a0ba502c339a30157a5baa4990b6b98caa47d167351b4
Contents?: true
Size: 750 Bytes
Versions: 14
Compression:
Stored size: 750 Bytes
Contents
# frozen_string_literal: true 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: _('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
Version data entries
14 entries across 14 versions & 1 rubygems