Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sso_pipeline_roles.py fix for Netbox v4.0.0 in develop/docs/auth.md #214

Closed
marsteel opened this issue May 15, 2024 · 0 comments
Closed
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation
Milestone

Comments

@marsteel
Copy link

[netbox-chart/docs
/auth.md](https://github.com/netbox-community/netbox-chart/blob/develop/docs/auth.md)

The sso_pipeline_roles.py will break for >Netbox v4.0.0
Please refer to thread netbox-community/netbox#9635 (reply in thread)

Starting with Netbox v4.0.x , the "Group" in similiar statement of kinds of customized sso_pipeline_roles.py is empty if it is from "from django.contrib.auth.models import Group"

from django.contrib.auth.models import Group
groups = Group.objects.all()

#Debug
print("All available groups in Netbox setting: ")
print(groups)
The Group is empty. As Group is empty, any logic iterating over this Emply group and adding user to each returned group item will break.

     #Group is empty, so groups is empty
      groups = Group.objects.all()
     #group is empty
      for group in groups:
        try:
          if group.name in roles:
            group.user_set.add(user)  # can't user_set.add() for empty group
          else:
            group.user_set.remove(user)
        except Group.DoesNotExist:
          continue

May 15, 2024 at 10:52 (UTC+2:00) | All available groups in Netbox setting: | netbox-container
May 15, 2024 at 10:52 (UTC+2:00) | <QuerySet []> | netbox-container

@marsteel marsteel changed the title sso_pipeline_roles.py fix in develop/docs/auth.md sso_pipeline_roles.py fix for Netbox v4.0.0 in develop/docs/auth.md May 15, 2024
@RangerRick RangerRick self-assigned this May 23, 2024
@RangerRick RangerRick added bug Something isn't working documentation Improvements or additions to documentation labels May 23, 2024
@RangerRick RangerRick added this to the 5.0.0 milestone May 23, 2024
RangerRick added a commit that referenced this issue May 23, 2024
RangerRick added a commit that referenced this issue May 23, 2024
RangerRick added a commit that referenced this issue May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants