Project

General

Profile

Bug #26210

Locked Templates are getting removed by api

Added by Ondřej Pražák over 1 year ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Category:
Templates
Target version:
-
Difficulty:
trivial
Triaged:
No
Bugzilla link:
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.

Associated revisions

Revision bad5f878 (diff)
Added by Dominik Matoulek 4 months ago

Fixes #26210 - Don't remove locked template

History

#1 Updated by Ondřej Pražák over 1 year ago

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

#2 Updated by Tomer Brisker 5 months ago

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

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.

#3 Updated by Dominik Matoulek 4 months ago

  • Assignee set to Dominik Matoulek

#4 Updated by The Foreman Bot 4 months ago

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

#5 Updated by The Foreman Bot 4 months ago

  • Fixed in Releases 2.1.0 added

#6 Updated by Dominik Matoulek 4 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF