Skip to main content

InvenTree SL Guard

Community-developed InvenTree plugin — v0.3.1 beta, verified on InvenTree 1.6.1.

A warehouse is a physical system, not an arbitrary tree of editable database records. Rooms, aisles, racks and fixed shelves occupy real places. When their digital hierarchy changes without a matching change on the warehouse floor, the location map stops reflecting reality.

A warehouse is not a nesting doll. You cannot put the warehouse itself inside a cardboard box. A room does not belong in a bag; nor should a rack or fixed shelf suddenly become the child of a movable container in the digital location tree. If the database says a shelf is inside a bag while the shelf is bolted to the wall, the database is wrong — not the physical world.

SL Guard helps prevent such unauthorized structural rearrangements for locations whose types an administrator has marked as protected. It enforces those movement restrictions; it is not a general-purpose dimensional or physical-fit validator.

SL Guard gives InvenTree's stock-location hierarchy a protected structural backbone. Administrators designate types that represent fixed infrastructure. Unauthorized users cannot relocate those locations, change an existing protected type, or indirectly move protected descendants by moving an ancestor. Authorized staff can deliberately revise the layout, while everyday stock movements remain governed by normal InvenTree permissions.

Keep the digital warehouse true to the physical one. Let inventory move — not the infrastructure around it.

Support on Ko-fi

SL Guard is free and open source. If you find it useful, you can support continued development on Ko-fi. Donations are entirely optional.

Features

  • Choose protected StockLocationType records by database ID, not by name.
  • Let normal users assign a protected type when they have regular InvenTree stock-location edit permissions.
  • Block changing the parent or removing/replacing an existing protected type, except for superusers and groups explicitly allowed by the plugin, subject to normal InvenTree permissions and ownership checks.
  • Prevent indirect relocation of protected descendants when moving an unprotected ancestor.
  • Bulk-assign types from an embedded panel: full hierarchical paths, selectable search fields (name, path, current type, ID), optional JavaScript regex, checkboxes, preview/dry-run, transactional server-side commit.
  • Retain ordinary editing of names/descriptions, normal stock-item moves, and moves of locations without protected descendants.
  • Optional SL Guard navigation shortcut and SL Guard dashboard widget (matching shield symbol). Both are independently configurable by the superuser; hiding either does not disable protection or remove the management route.

Compatibility caution: This beta is tested on InvenTree 1.6.1, not on every InvenTree release. It wraps an internal LocationSerializer.validate method at runtime to pass the authenticated request user to the model validation hook. This is a monkey patch, not a stable public plugin API. Review and test before upgrading InvenTree.

This package is not yet published on PyPI. Install it directly from the public GitHub repository using InvenTree's built-in plugin installer (verified on InvenTree 1.6.1).

  1. Back up your database and configuration; test on a non-production instance first. Ensure external plugins are enabled (plugins_enabled: true).

  2. Sign in as an InvenTree superuser, then open Settings → Admin → Plugins → Install Plugin.

  3. Fill out the installer form:

    Field Value
    Package Name inventree-sl-guard
    Source URL git+https://github.com/SntPartizan/inventree-sl-guard.git
    Version Leave blank
    Confirm plugin installation Enabled
  4. Click Install. InvenTree runs pip in its own Python environment, discovers the plugin and collects its static files.

  5. In the plugin list, activate SL Guard (listed as SL Guard). Restart the InvenTree web process and background workers if needed so all processes load the new code. If the UI still shows old JavaScript, hard-refresh the browser; run manage.py collectplugins with the correct InvenTree configuration only if static-file collection needs troubleshooting.

  6. Configure Protected StockLocationType IDs and, optionally, Authorized group IDs in SL Guard settings. The management page is at /web/plugin/sl-guard/manage (relative to your InvenTree server).

  7. Test that an ordinary user cannot relocate a protected stock location and that an authorized administrator can.

Dashboard widget: SL Guard makes the widget available, but does not add it automatically. Add it through the normal Dashboard → Add Widgets interface. The navigation item and dashboard widget can be enabled or disabled independently in SL Guard settings; disabling these shortcuts does not disable protection.

Updating from GitHub

From Settings → Admin → Plugins, use the installed package's Update action. Supply the same Source URL (git+https://github.com/SntPartizan/inventree-sl-guard.git) again; InvenTree 1.6.1 pre-fills the package name but may not pre-fill the Git URL. Leave Version blank for the current repository branch. After upgrading, check the displayed version and verify the protection rules. Settings persist for upgrades of the same sl-guard plugin, but should still be verified.

For reproducible deployments, pin a tested Git tag in the URL (for example git+https://github.com/SntPartizan/inventree-sl-guard.git@v0.3.1 after creating that tag). No PyPI-based install or update is available until this package is actually published there.

Alternative: manual wheel installation

For offline development or deployments where the GUI installer is unavailable, install a downloaded release wheel in the same Python environment as InvenTree:

python -m pip install --no-deps --upgrade ./inventree_sl_guard-0.3.1-py3-none-any.whl

Restart web and worker processes, activate the plugin and collect static files if needed. Do not run the command against an unrelated system Python environment.

The UI brand is SL Guard in every language. English and Russian panel translations are provided. The distribution is inventree-sl-guard, the plugin's display name is SL Guard, and its slug is sl-guard.

See Russian instructions, localization notes, and deployment notes.

Permissions

Operation User with normal location-edit permission Superuser / configured group (plus normal permissions)
Assign a protected type to an unprotected location Allowed Allowed
Change an already-protected type Blocked Allowed
Move a protected location Blocked Allowed
Move an unprotected location containing protected descendants Blocked Allowed
Edit location name / description Allowed Allowed

The settings (PROTECTED_TYPE_IDS, ALLOWED_GROUP_IDS) are administered by a superuser; a group ID alone does not replace InvenTree's own role and ownership checks.

Search and bulk assignment

The page shows each location's full path and unique ID. Search checks name only by default, so a query for Rack will not match boxes merely because their ancestor is a rack. Enable path/type/ID matching separately. Regex examples: Rack|Shelf (OR), ^(Rack|Shelf) (start of name), \d+ (digits). Selection is always by primary key, not the displayed path. Preview before applying a batch.

For large batches the UI has a separate 120-second HTTP timeout. A browser timeout does not prove rollback: reload the list and check current types before retrying.

Testing and packaging

python -m pip install -e . --no-deps
python -m pip install pytest build twine
python -m pytest -q tests
node --test tests/js/*.test.mjs
python -m build
python -m twine check dist/*

These tests cover policy, UI filtering and regression checks; they do not replace InvenTree/DB/API integration tests. Required pre-release scenarios.

Security and limitations

  • Model save() validation cannot catch all direct SQL, QuerySet.update(), tree-bulk operations, or deletion of protected types/locations. Do not advertise this plugin as a comprehensive database-level access-control solution.
  • The authenticated-user integration is tied to InvenTree 1.6.1 internals. Verify the bridge on every supported version.
  • The default InvenTree barcode-scanning UI may hide the error reason and show a generic message. An optional developer-only script is in tools/patch_scan_error_ui.py; it modifies InvenTree frontend source and is not part of the wheel. Do not apply it automatically.
  • The embedded admin UI supports English (default) and Russian based on the InvenTree frontend locale. Server-side API errors use the active Django language. Plugin metadata and static settings labels use English.

For responsible disclosure see SECURITY.md. Licensed under MIT. This is an independent community project, not an official InvenTree component.

Metadata

Release files for inventree-sl-guard 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inventree-sl-guard 0.3.1
File Size Uploaded Provenance Actions
inventree_sl_guard-0.3.1.tar.gz 32.0 kB With provenance Details for inventree_sl_guard-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inventree-sl-guard 0.3.1
File Interpreter ABI Platform Actions
inventree_sl_guard-0.3.1-py3-none-any.whl Python 3 none any Details for inventree_sl_guard-0.3.1-py3-none-any.whl

Total release size: 64.5 kB

Release files / inventree_sl_guard-0.3.1.tar.gz

Download URL inventree_sl_guard-0.3.1.tar.gz
Size 32.0 kB
Tags Source
SHA-256 checksum
How to use checksums
68d18642189807e8805b09f6e9b166b2fd20603689197ac97d4afe0b44d85c16
BLAKE2b-256 checksum
How to use checksums
8f8710e1c96d2d862e7402c44afa182645a3b91d344da954dc9dba6f383169b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / inventree_sl_guard-0.3.1-py3-none-any.whl

Download URL inventree_sl_guard-0.3.1-py3-none-any.whl
Size 32.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acb042be97c06352305f564c8ad4fe215404c8a06ef9360c9a6b77a1b2f40690
BLAKE2b-256 checksum
How to use checksums
f17aa0dad8f7df3d5eaee95cca6b158d59a4c1c3444f39d48e246e1ff4114149
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for inventree-sl-guard 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for inventree_sl_guard-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page