def METHOD_NAME(token):
    """Verify the supplied token and check user role is correct for the requested resource"""
    tm.authenticated_user_id = None
    if not token:
        return False
    try:
        decoded_token = base64.b64decode(token).decode("utf-8")
    except UnicodeDecodeError:
        current_app.logger.debug(f"Unable to decode token {request.base_url}")
        return False  # Can't decode token, so fail login
    valid_token, user_id = AuthenticationService.is_valid_token(decoded_token, 604800)
    if not valid_token:
        current_app.logger.debug(f"Token not valid {request.base_url}")
        return False
    tm.authenticated_user_id = (
        user_id  # Set the user ID on the decorator as a convenience
    )
    return user_id  # All tests passed token is good for the requested resource