netbox/docs
Jason Novinger 5bbab7eb47
Some checks failed
CI / build (20.x, 3.12) (push) Has been cancelled
CI / build (20.x, 3.13) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Has been cancelled
Closes #16681: Introduce render_config permission for configuration rendering (#20555)
* Closes #16681: Introduce render_config permission for configuration rendering

Add a new custom permission action `render_config` for rendering device and
virtual machine configurations via the REST API. This allows users to render
configurations without requiring the `add` permission.

Changes:
- Add permission check to RenderConfigMixin.render_config() for devices and VMs
- Update API tests to use render_config permission instead of add
- Add tests verifying permission enforcement (403 without render_config)
- Document new permission requirement in configuration-rendering.md

Note: Currently requires both render_config AND add permissions due to the
automatic POST='add' filter in BaseViewSet.initial(). Removing the add
requirement will be addressed in a follow-up commit.

* Correct permission denied message and enable translation

* Remove add permission requirement for render_config endpoint

Remove the add permission requirement from the render-config API endpoint
while maintaining token write_enabled enforcement as specified in #16681.

Changes:
- Add TokenWritePermission class to check token write ability without requiring
  specific model permissions
- Override get_permissions() in RenderConfigMixin to use TokenWritePermission
  instead of TokenPermissions for render_config action
- Replace queryset restriction: use render_config instead of add
- Remove add permissions from tests - render_config permission now sufficient
- Update tests to expect 404 when permission denied (NetBox standard pattern)

Per #16681: 'requirement for write permission makes sense for API calls
(because we're accepting and processing arbitrary user data), the specific
permission for creating devices does not'

* Add render_config permission to ConfigTemplate render endpoint

Extend render_config permission requirement to the ConfigTemplate render
endpoint per issue comments.

Changes:
- Add TokenWritePermission check via get_permissions() override in
  ConfigTemplateViewSet
- Restrict queryset to render_config permission in render() method
- Add explicit render_config permission check
- Add tests for ConfigTemplate.render() with and without permission
- Update documentation to include ConfigTemplate endpoint

* Address PR feedback on render_config permissions

Remove redundant permission checks, add view permission enforcement via
chained restrict() calls, and rename ConfigTemplate permission action
from render_config to render for consistency.

* Address second round of PR feedback on render_config permissions

- Remove ConfigTemplate view permission check from render_config endpoint
- Add sanity check to TokenWritePermission for non-token auth
- Use named URL patterns instead of string concatenation in tests
- Remove extras.view_configtemplate from test permissions
- Add token write_enabled enforcement tests for all render endpoints

* Misc cleanup

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2025-10-21 09:26:06 -04:00
..
_theme Closes #16669: Include a notice when rendering docs locally 2024-09-17 14:44:51 -04:00
administration Merge branch 'main' into feature 2025-09-16 12:00:48 -04:00
best-practices #20382: Additional GraphQL API tips (#20451) 2025-09-30 11:29:29 -04:00
configuration #20603: Split GraphQL API into v1 & v2 2025-10-20 11:00:23 -04:00
customization Closes #20096: Remove legacy load_yaml() & load_json() methods from BaseScript 2025-09-11 11:30:15 -04:00
development Merge branch 'main' into feature 2025-10-01 08:03:43 -04:00
features Closes #16681: Introduce render_config permission for configuration rendering (#20555) 2025-10-21 09:26:06 -04:00
getting-started Update planning.md to cleanup grammar 2025-09-06 11:09:01 -04:00
installation Update documentation 2025-10-03 14:24:21 -04:00
integrations Closes #20492: Disable API token plaintext retrieval 2025-10-14 14:57:37 -04:00
media Fixes #19841: Add white background to upgrade paths image 2025-07-14 15:08:27 -04:00
models Closes #20449: Add user preferences documentation (#20460) 2025-09-30 13:16:36 -05:00
plugins Merge branch 'main' into feature 2025-10-14 13:54:47 -04:00
reference #20175 Fix Grammatical Error Related To Capitalization 2025-08-25 14:28:35 -04:00
release-notes Release v4.4.4 (#20594) 2025-10-15 14:25:43 -05:00
extra.css Fixes: #17732 - Add a background-color to img elements in docs to ensure readability in dark mode (#17790) 2024-10-18 10:47:05 -04:00
index.md Closes #19611: Update index.md To Spell Acronym First Time It's Found (#19614) 2025-05-30 13:57:22 -05:00
introduction.md Closes #18820: Bump minimum PostgreSQL version to 14 (#18909) 2025-03-14 13:45:44 -05:00
netbox_logo_dark.svg Fixes: #17732 - Add a background-color to img elements in docs to ensure readability in dark mode (#17790) 2024-10-18 10:47:05 -04:00
netbox_logo_light.svg Fixes: #17732 - Add a background-color to img elements in docs to ensure readability in dark mode (#17790) 2024-10-18 10:47:05 -04:00