Skip to main content

Services for Netbox

Project description

NetBox HideBox Plugin

NetBox HideBox is a plugin for NetBox that allows you to dynamically hide form fields based on the user’s group membership. This can be useful for restricting access to certain form fields depending on the user’s role or group in your organization.

Table of Contents

Features

  • Dynamically hide fields on NetBox forms based on user group membership.
  • Easy configuration.
  • Applies to any form related to a specific model in NetBox.
  • Granular control of field visibility for multiple user groups.

Requirements

  • netbox 4.0+
  • python 3.11+

Compatibility Matrix

NetBox Version Plugin Version
4.0+ 1.0+

Installation

To install the NetBox HideBox plugin, follow these steps:

  1. Clone the Repository or add the plugin to your project’s requirements:

    pip install netbox-hidebox
    
  2. Enable the Plugin in your NetBox configuration file (configuration.py):

    PLUGINS = [
       'netbox_hidebox',
    ]
    
  3. Configure Plugin Settings (see Configuration for details).

  4. Restart NetBox to apply changes:

    sudo systemctl restart netbox
    

Configuration

The core of the plugin is controlled by the HIDDEN_FIELDS setting in your settings.py or configuration.py file. This is where you define which fields to hide for which models and specify the user groups that are exempt from hiding.

Plugin Configuration Structure

In your NetBox configuration (configuration.py):

PLUGINS_CONFIG = {
    'netbox_hidebox': {
        'HIDDEN_FIELDS': {
            # Model identifier: {'field_name': ['excluded_group1', 'excluded_group2']}
            'app_label.model_name': {
                'field_name1': ['Group A', 'Group B'],  # Field hidden if user not in Group A or Group B
                'field_name2': ['Group C'],              # Field hidden if user not in Group C
            },
            'ipam.ipaddress': {
                'status': [],          # Leave Empty to hide for all Groups
            }
        }
    }
}

In your NetBox setting (settings.py):

MIDDLEWARE = [
    'netbox_hidebox.middleware.RequestMiddleware',  # Place it early in the list; recommended to place before the first netbox-middleware
    # Other middleware...
]

Explanation

  • app_label.model_name: The full identifier of the model (e.g., ipam.ipaddress).
  • field_name: The name of the field you want to hide (e.g., status).
  • excluded_groups: A list of user group names. If the user is not in any of these groups, the field will be hidden.

Usage

Once configured, the plugin will automatically hide fields on relevant forms based on the user’s group membership.

Example Scenario

Suppose you have the following configuration:

PLUGINS_CONFIG = {
    'netbox_hidebox': {
        'HIDDEN_FIELDS': {
            'ipam.ipaddress': {
                'description': ['Network Engineers', 'Admins'],
                'vrf': ['Admins'],
            }
        }
    }
}
  • description field in the IP Address form will be hidden for users who are not in the "Network Engineers" or "Admins" group.
  • vrf field will only be visible to users in the "Admins" group.

Adding/Removing Fields

To modify the configuration:

  • Edit the HIDDEN_FIELDS section in configuration.py.
  • Restart NetBox to apply the changes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netbox_hidebox-1.2.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netbox_hidebox-1.2.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file netbox_hidebox-1.2.0.tar.gz.

File metadata

  • Download URL: netbox_hidebox-1.2.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for netbox_hidebox-1.2.0.tar.gz
Algorithm Hash digest
SHA256 3b6a13c3442997a5328b4a18345579ff1f9812406fe1cefb6038e677bdae15a3
MD5 af411f463bff90a88ebf06626ebe4e7f
BLAKE2b-256 a5eea1c2640d7894ce3debfd9a1b060879132ff7ff0adda41d11773c2b26eb48

See more details on using hashes here.

File details

Details for the file netbox_hidebox-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: netbox_hidebox-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for netbox_hidebox-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79304ce9c7f34ca875594712e6f1e362e95a9b97caea72dd8ca3ac855c57efc6
MD5 33a8b74cb18c89c5732e0ee1314ad8d3
BLAKE2b-256 110f52c03657ef6875d4507f4ba2dc7f76a589dc564e5ddca6e5bde227759a17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page