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

Self user details for logged in user #6338

Merged

Conversation

shubham-mahajan
Copy link
Member

Fixes #5490

Proposed fixes:

As discussed in #5504 (comment), we are not creating an extra action but adding the functionality in the current user_show action. So added the check to validate whether the user is logged in and if logged in return the user details.

Features:

  • includes tests covering changes
  • includes updated documentation
  • includes user-visible changes
  • includes API changes
  • includes bugfix for possible backport

Please [X] all the boxes above that apply

Currently, we cannot determine the user details of the user
which is logged in without passing the id, so method is modified
to fetch the details of the current user if the user is logged in.
@shubham-mahajan shubham-mahajan changed the title Feature/self user details for logged in Self user details for logged in user Aug 24, 2021
@@ -1386,6 +1388,9 @@ def user_show(context, data_dict):
'''
model = context['model']

if 'user' in context and 'id' not in data_dict:
data_dict['id'] = context.get('user')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way you've made this change the optional user_obj will never be used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wardi Fixed.

@wardi
Copy link
Contributor

wardi commented Aug 26, 2021

@shubham-mahajan thanks.

On second thought while we're here it would be better to completely disable the user_obj parameter and remove it from the documentation. There's no legitimate use for the parameter that I can see and its current behavior could even be dangerous.

Also please add a changes file for this new feature so that it appears in the changelog of our next release.

@shubham-mahajan
Copy link
Member Author

@wardi Agree with the removal of user_obj.

Updated the code and updated the changes file also for easy changelog handling.

@shubham-mahajan
Copy link
Member Author

@wardi Anything needed for this PR?

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.

There is no way to determine the user ID when connecting through the API
2 participants