You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The various client handlers contain business logic related to how to e.g. disconnect a user from an OAuth service which shouldn't depend on the request context. Example from invenio_oauthclient.contrib.orcid.disconnect_handler:
...
defdisconnect_handler(remote, *args, **kwargs):
"""Handle unlinking of remote account. :param remote: The remote application. """# ...this is request-related...ifnotcurrent_user.is_authenticated:
returncurrent_app.login_manager.unauthorized()
# -- START --# This part should be in a different function, since it only depends on a User IDaccount=RemoteAccount.get(user_id=current_user.get_id(),
client_id=remote.consumer_key)
orcid=account.extra_data.get('orcid')
iforcid:
oauth_unlink_external_id({'id': orcid, 'method': 'orcid'})
ifaccount:
withdb.session.begin_nested():
account.delete()
# -- END --# ...this is request-related...returnredirect(url_for('invenio_oauthclient_settings.index'))
...
The text was updated successfully, but these errors were encountered:
slint
changed the title
global: make a better separation between request-related
global: make a better separation between request-related and "business logic" code
Oct 4, 2018
The various client handlers contain business logic related to how to e.g. disconnect a user from an OAuth service which shouldn't depend on the request context. Example from
invenio_oauthclient.contrib.orcid.disconnect_handler
:The text was updated successfully, but these errors were encountered: