Project

General

Profile

Actions

Bug #26210

closed

Locked Templates are getting removed by api

Added by Ondřej Pražák about 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Templates
Target version:
-
Difficulty:
trivial
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Description of problem:
Locked template are getting deleted through API request

How reproducible:
Always

Steps to Reproduce:
1. Sat webUI>Monitor>Report Templates>Either pick any of the default template or clone and existing template(later is preferred)>Lock it
2. From the console, fire the below DELETE request-
$ curl -u admin:<pwd> -k -X DELETE https://&lt;foreman-fqdn&gt;/api/report_templates/&lt;teplate-id> -H 'content-type: application/json'

3. API response returns the below error- {"errors":{"base":["This template is locked and may not be removed."]}}

Actual results:
API returns the error that suggests- the template is locked and may not be removed. However, it actually removes the template.

Expected results:
There is no option to remove the locked template from the webUI so, API should also not delete the locked template OR it should prompt to unlock the template before deleting. It will avoid the accidental deletion of locked template through the API.

Actions #1

Updated by Ondřej Pražák about 5 years ago

  • Subject changed from Locked Report Templates are getting removed. to Locked Report Templates are getting removed.
  • Category changed from Statistics to Templates
  • Priority changed from High to Normal
Actions #2

Updated by Tomer Brisker about 4 years ago

  • Subject changed from Locked Report Templates are getting removed. to Locked Templates are getting removed by api
  • Difficulty set to trivial

this affects all template types. The reason is that the callback checking if the template is locked only adds an error but doesn't throw(:abort) to stop the destruction process.

Actions #3

Updated by Dominik Matoulek about 4 years ago

  • Assignee set to Dominik Matoulek
Actions #4

Updated by The Foreman Bot about 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/7572 added
Actions #5

Updated by The Foreman Bot about 4 years ago

  • Fixed in Releases 2.1.0 added
Actions #6

Updated by Dominik Matoulek about 4 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF