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

Pass existing object references within access methods #14

Merged
merged 1 commit into from Sep 8, 2017
Merged

Pass existing object references within access methods #14

merged 1 commit into from Sep 8, 2017

Conversation

AlanCoding
Copy link
Member

@AlanCoding AlanCoding commented Aug 30, 2017

Just looking at /inventories/N/hosts/, we retrieve the inventory (pk=N) 6 distinct times. This is because we had a habit of passing the pk from one piece of code to another, at which point the 2nd piece of code would go turn the pk into a python object. With this change, the method is called 0 for a GET to that endpoint, because the view constructs its own lookup.

I argue that this revision actually leaves us with fewer moving parts and better modularization.

Signed-off-by: Alan Rominger arominge@redhat.com

This avoids re-loading objects from the database in our
chain of permission checking, wherever possible.
access.py is equiped to handle object references instead
of pk ints, and permissions.py is changed to pass those refs.
@matburt matburt merged commit 2fb9b6c into ansible:devel Sep 8, 2017
mabashian pushed a commit to mabashian/awx that referenced this pull request Jun 28, 2019
kdelee pushed a commit that referenced this pull request Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants