Class: Mutations::OvalPolicies::Create

Inherits:
BaseMutation
  • Object
show all
Defined in:
app/graphql/mutations/oval_policies/create.rb

Instance Method Summary collapse

Instance Method Details

#resolve(hostgroup_ids:, **params) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'app/graphql/mutations/oval_policies/create.rb', line 21

def resolve(hostgroup_ids:, **params)
  policy = ::ForemanOpenscap::OvalPolicy.new params
  validate_object(policy)
  authorize!(policy, :create)
  check_collection = ::ForemanOpenscap::Oval::Configure.new.assign(policy, hostgroup_ids, ::Hostgroup)
  {
    :oval_policy => policy,
    :check_collection => check_collection.checks
  }
end