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

Disconnect logic to fill in role parents #15462

Draft
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

AlanCoding
Copy link
Member

@AlanCoding AlanCoding commented Aug 23, 2024

SUMMARY

For code removals after RBAC changes, this is my first pass, since it is the most mechanistic change.

A role (in the old system) has both parent roles and ancestor roles tracked in relationships. We have already disconnected the logic for rebuilding ancestors but rebuilding parents is more minimal... although still maintained via connected signals.

The goal of this PR is to gut the signals for role parent rebuilding. This gets weird in a few cases, like how editing related ForeignKey fields can change role parents. I want to also be thorough about tracing de-referenced methods and deleting them.

ping @hakbailey

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • API

@AlanCoding AlanCoding marked this pull request as draft August 23, 2024 00:15
Copy link

sonarcloud bot commented Aug 23, 2024

@AlanCoding
Copy link
Member Author

The checks here are actually looking fairly okay-ish to me. Just need to get some integration testing results to confirm that nothing unexpected is happening.

YOLO 10152

@AlanCoding
Copy link
Member Author

Question: should we also remove the role parents/children sub-endpoint with this change?

awx/awx/api/views/__init__.py

Lines 4464 to 4489 in 7ed0eee

class RoleParentsList(SubListAPIView):
deprecated = True
model = models.Role
serializer_class = serializers.RoleSerializer
parent_model = models.Role
relationship = 'parents'
permission_classes = (IsAuthenticated,)
search_fields = ('role_field', 'content_type__model')
def get_queryset(self):
role = models.Role.objects.get(pk=self.kwargs['pk'])
return models.Role.filter_visible_roles(self.request.user, role.parents.all())
class RoleChildrenList(SubListAPIView):
deprecated = True
model = models.Role
serializer_class = serializers.RoleSerializer
parent_model = models.Role
relationship = 'children'
permission_classes = (IsAuthenticated,)
search_fields = ('role_field', 'content_type__model')
def get_queryset(self):
role = models.Role.objects.get(pk=self.kwargs['pk'])
return models.Role.filter_visible_roles(self.request.user, role.children.all())

They won't be correct after this (I'd expect they'll have nothing.

@AlanCoding
Copy link
Member Author

^ answer is trending "yes"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant