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

Modify user_in_hubmap_read_group to utilize commons has_read_privs method #547

Open
maxsibilla opened this issue Oct 12, 2023 · 1 comment

Comments

@maxsibilla
Copy link

Modify method to be:

    if 'Authorization' not in request.headers:
        return False

    try:
        user_token = get_user_token(request)
        read_privs = auth_helper_instance.has_read_privs(user_token)
        if isinstance(read_privs, Response):
            msg = read_privs.get_data().decode()
            logger.exception(msg)
            return False            

    except Exception as e:
        # Log the full stack trace, prepend a line with our message
        logger.exception(e)

        # If the token is not a groups token, no group information available
        # The commons.sn_auth.AuthCache would return a Response with 500 error message
        # We treat such cases as the user not in the SenNet-READ group
        return False

    return read_privs
@maxsibilla
Copy link
Author

After discussing this card (hubmapconsortium/commons#119) with @shirey the simple solution is to re-use this commons method for consistency sake.

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

No branches or pull requests

1 participant