ruby-jss icon indicating copy to clipboard operation
ruby-jss copied to clipboard

Policy's Self Service Category able to be removed from Self Service Categories

Open cybertunnel opened this issue 4 years ago • 1 comments

Found this bug where a self_service_category can have it's display_in to false but if it is in the array, it will default to true anyways when posted to the API.

Example:

  • I run the command: policy.add_self_service_category 'Testing', display_in: false
  • Validate the results are correct: policy.self_service_categories which results to `[{:id=>18, :name=>"Testing", :display_in=>false, :feature_in=>false}]
  • However, when I pull from the API again, and run policy.self_service_categories which results to `[{:id=>18, :name=>"Testing", :display_in=>true, :feature_in=>false}]

Suggested fixes:

  • If display_in is set to false, throw and error
  • if display_in is set to false, remove from self_service_categories
  • Force display_in to be set to true, push user to use policy.remove_self_service_category(cat) to remove categories

cybertunnel avatar Apr 08 '20 16:04 cybertunnel

Turns out the above issue was around my error. However, this did bring to light a bug where ruby-jss allows me to remove the category the policy is assigned. This violates Jamf's Self Service functions of categories since a policy's category has the policy always displayed in Self Service under that category.

Suggested fix: Throw an error when user attempts to remove the category the policy/object is assigned to using the policy.remove_self_service_category

cybertunnel avatar Apr 08 '20 16:04 cybertunnel