Project

General

Profile

Actions

Bug #26210

closed

Locked Templates are getting removed by api

Added by Ondřej Pražák about 6 years ago. Updated about 5 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

Also available in: Atom PDF