Assign users and groups as object owners #11591

Closed
opened 2025-12-29 21:47:17 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Sep 9, 2025).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v4.4.0

Feature type

New functionality

Proposed functionality

This FR seeks to enable the assignment of one or more users and/or groups as the owner(s) of individual objects within NetBox by introducing a new Owner model and establishing a standard foreign key on most core models.

Owner Model

A new Owner model will be added in the users app, with M2M relations to the User and Group models. The purpose of this model is to separate the assignment of users/groups from the assignment of objects. It should look roughly like this:

class Owner(PrimaryModel):
    name = CharField(unique=True)
    users = ManyToManyField(to='users.User', blank=True)
    groups = ManyToManyField(to='users.Group', blank=True)

Add owner ForeignKey to models

A new feature mixin, OwnershipMixin, will be introduced to add an optional owner ForeignKey to most models. This mixin will be included in the default NetBoxFeatureSet mixin, which is inherited by the common base model classes (e.g. PrimaryModel).

    owner = ForeignKey(to='users.Owner', blank=True, null=True)

The assignment of an owner will be optional for all models, however the assignment of an owner could be enforced using a custom validator.

Owner assignment will be modifiable via both the UI and REST API, and can be queried/filtered via the GraphQL API.

It should be noted that the concept of ownership will extend only to models which represent managed resources. Custom links and export templates, for instance, will not support ownership as these exist strictly to support application functions.

Permission assignment

Administrators will be able to reference object owners like other fields when crafting user and group permissions. However, any proposed extensions to the permissions framework will need to be addressed in a separate FR.

Use case

Currently, many users struggle to accomplish this using tags or, on certain models, tenant assignment (which is not the intended use for the Tenant model). This will provide a mechanism for conveying administrative ownership of objects within NetBox.

A common use case where this would be especially helpful is an organization who wants to give their customers limited access to see or potentially manage certain objects in NetBox.

Database changes

  • Create the users.Owner model
  • Add the owner ForeignKey to applicable models (complete list TBD)

External dependencies

N/A

Originally created by @jeremystretch on GitHub (Sep 9, 2025). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v4.4.0 ### Feature type New functionality ### Proposed functionality This FR seeks to enable the assignment of one or more users and/or groups as the owner(s) of individual objects within NetBox by introducing a new Owner model and establishing a standard foreign key on most core models. #### Owner Model A new Owner model will be added in the `users` app, with M2M relations to the User and Group models. The purpose of this model is to separate the assignment of users/groups from the assignment of objects. It should look roughly like this: ```python class Owner(PrimaryModel): name = CharField(unique=True) users = ManyToManyField(to='users.User', blank=True) groups = ManyToManyField(to='users.Group', blank=True) ``` #### Add `owner` ForeignKey to models A new feature mixin, `OwnershipMixin`, will be introduced to add an optional `owner` ForeignKey to most models. This mixin will be included in the default `NetBoxFeatureSet` mixin, which is inherited by the common base model classes (e.g. `PrimaryModel`). ```python owner = ForeignKey(to='users.Owner', blank=True, null=True) ``` The assignment of an owner will be optional for all models, however the assignment of an owner could be enforced using a [custom validator](https://netboxlabs.com/docs/netbox/customization/custom-validation/). Owner assignment will be modifiable via both the UI and REST API, and can be queried/filtered via the GraphQL API. It should be noted that the concept of ownership will extend only to models which represent managed resources. Custom links and export templates, for instance, will not support ownership as these exist strictly to support application functions. #### Permission assignment Administrators will be able to reference object owners like other fields when crafting user and group permissions. However, any proposed extensions to the permissions framework will need to be addressed in a separate FR. ### Use case Currently, many users struggle to accomplish this using tags or, on certain models, tenant assignment (which is _not_ the intended use for the Tenant model). This will provide a mechanism for conveying administrative ownership of objects within NetBox. A common use case where this would be especially helpful is an organization who wants to give their customers limited access to see or potentially manage certain objects in NetBox. ### Database changes - Create the `users.Owner` model - Add the `owner` ForeignKey to applicable models (complete list TBD) ### External dependencies N/A
adam added the type: featurecomplexity: mediumnetboxstatus: backlog labels 2025-12-29 21:47:17 +01:00
adam closed this issue 2025-12-29 21:47:18 +01:00
Author
Owner

@peterbaumert commented on GitHub (Sep 10, 2025):

Would it be possible to add the "primary", "secondary" etc part like in contacts? Then my FR #19453 is met too :)

@peterbaumert commented on GitHub (Sep 10, 2025): Would it be possible to add the "primary", "secondary" etc part like in contacts? Then my FR #19453 is met too :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11591