QuerySets: filter permissions by organizations #8298
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
With the aim to bring logic from .com to .org more closer I'm moving the organization's filters to .org. They are going to be used if `RTD_ALLOW_ORGANIZATIONS` is True, but they eventually will be merged with the current querysets when organizations and normal projects are supported in .org. In .com we are relying on user.projects having the the projects where the user is member of and organization owner (we are syncing this with signals). We don't rely on that hack anymore and always check from the organization models. The signals won't be removed for now, but shouldn't be needed anymore. To re-use more code I have brought the SSO concept here, but isn't implemented yet, we can bring the SSO models and logic later easily. This could be seen as more queries, but the main ones were already being executed in .com. The other ones are executed only when using the API V2, so I don't think that would be a problem. I started this refactor using a mixin, but then we would need to override every single queryset in .com, using composition only requires one override (already used), and doesn't bring other methods into the class.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.