Skip to content

[4.0.0]Custom pipeline - Create groups for SAML #16000

Answered by CTV-2023
CTV-2023 asked this question in Help Wanted!
Discussion options

You must be logged in to vote

@pgodzwa I found the solution reading docs 👍
As an introduction :
https://github.com/netbox-community/netbox/blob/develop/docs/development/models.md

We find the code here
https://github.com/netbox-community/netbox/blob/develop/netbox%2Fnetbox%2Fauthentication%2F__init__.py

I had to make 2 changes :
This line
from django.contrib.auth.models import Group

Is now
from netbox.authentication import Group

And in new Netbox group implementation, we can't assign users to a group, only groups to user (I'll submit a bug report just in case) so this line (in my original code)
group.user_set.add(user)

Is now
user.groups.add(group)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CTV-2023
Comment options

Answer selected by CTV-2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants