Permission #6396

Closed
opened 2025-12-29 19:40:12 +01:00 by adam · 4 comments
Owner

Originally created by @GoodiesHQ on GitHub (Apr 23, 2022).

NetBox version

v3.2-1.6.1

Python version

3.9

Steps to Reproduce

  1. Log into NetBox Admin panel
  2. Click "permissions" and create a new entry
  3. Select object type(s) and user/group assignments
  4. Set the constraints to a JSON QuerySet filter such as {"status": "active"}

Expected Behavior

The permission would be saved and would only apply to objects with a "status" attribute value of "active". I've also tried "tenant" and "tenant__name" to no avail which is another filter I'd like to use.

Observed Behavior

The permission does not save and reports back with:

Invalid filter for <class 'django.contrib.auth.models.Group'>: Cannot resolve keyword 'status' into field. Choices are: id, name, object_permissions, permissions, user

If I use one of the "choices" it provides, I receive this error:
image

Originally created by @GoodiesHQ on GitHub (Apr 23, 2022). ### NetBox version v3.2-1.6.1 ### Python version 3.9 ### Steps to Reproduce 1. Log into NetBox Admin panel 2. Click "permissions" and create a new entry 3. Select object type(s) and user/group assignments 4. Set the constraints to a JSON QuerySet filter such as `{"status": "active"}` ### Expected Behavior The permission would be saved and would only apply to objects with a "status" attribute value of "active". I've also tried "tenant" and "tenant__name" to no avail which is another filter I'd like to use. ### Observed Behavior The permission does not save and reports back with: Invalid filter for <class 'django.contrib.auth.models.Group'>: Cannot resolve keyword 'status' into field. Choices are: id, name, object_permissions, permissions, user If I use one of the "choices" it provides, I receive this error: ![image](https://user-images.githubusercontent.com/4576046/164873722-6f9c708e-6984-409d-a2b6-dcb09127ae7e.png)
adam added the type: bug label 2025-12-29 19:40:12 +01:00
adam closed this issue 2025-12-29 19:40:12 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (Apr 23, 2022):

Not a bug. All chosen objects must have the attributes you are trying to filter on.

@kkthxbye-code commented on GitHub (Apr 23, 2022): Not a bug. All chosen objects must have the attributes you are trying to filter on.
Author
Owner

@DanSheps commented on GitHub (Apr 23, 2022):

Thank you for opening a bug report. It seems that the described functionality is intended behavior. If you meant to open a feature request instead, please close this issue and open a new one using the feature request template. Otherwise, please revise your post above to elaborate on why you believe the observed behavior is flawed.

@DanSheps commented on GitHub (Apr 23, 2022): Thank you for opening a bug report. It seems that the described functionality is intended behavior. If you meant to open a feature request instead, please close this issue and open a new one using the [feature request template](https://github.com/netbox-community/netbox/issues/new?template=feature_request.md). Otherwise, please revise your post above to elaborate on why you believe the observed behavior is flawed.
Author
Owner

@GoodiesHQ commented on GitHub (Apr 25, 2022):

Not a bug. All chosen objects must have the attributes you are trying to filter on.

Just to be clear, when selecting from this list of objects, everything I select must have the attribute I'm filtering on? My goal is to create a single user that can only view its own tenant (any and all objects, really) and has no write permissions at all.

From the error messages

image

I selected a subset of those items, all of which have "tenant" as an attribute, the permission succeeded, but the user is still able to see all devices and objects (it is read-only, but far more than just one tenant).

@GoodiesHQ commented on GitHub (Apr 25, 2022): > Not a bug. All chosen objects must have the attributes you are trying to filter on. Just to be clear, when selecting from this list of objects, everything I select must have the attribute I'm filtering on? My goal is to create a single user that can only view its own tenant (any and all objects, really) and has no write permissions at all. From the error messages ![image](https://user-images.githubusercontent.com/4576046/164947156-e24a6ca5-d47b-4da7-83ed-76e3a630d4e5.png) I selected a subset of those items, all of which have "tenant" as an attribute, the permission succeeded, but the user is still able to see all devices and objects (it is read-only, but far more than just one tenant).
Author
Owner

@kkthxbye-code commented on GitHub (Apr 25, 2022):

Just to be clear, when selecting from this list of objects, everything I select must have the attribute I'm filtering on?

Yes

My goal is to create a single user that can only view its own tenant (any and all objects, really) and has no write permissions at all.

Create multiple permissions. For everything that doesn't have a direct relationship with tenant, you have to create a permission for those. For example device components (interfaces, front/backports etc) would have a filter like {"device__tenant__name": "tenantnanme"}.

@kkthxbye-code commented on GitHub (Apr 25, 2022): > Just to be clear, when selecting from this list of objects, everything I select must have the attribute I'm filtering on? Yes > My goal is to create a single user that can only view its own tenant (any and all objects, really) and has no write permissions at all. Create multiple permissions. For everything that doesn't have a direct relationship with tenant, you have to create a permission for those. For example device components (interfaces, front/backports etc) would have a filter like `{"device__tenant__name": "tenantnanme"}`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6396