# Path: ddsc/exceptions.py
# class DDSUserException(Exception):
#     """
#     Exception with an error message to be displayed to the user on the command line.
#     """
#     pass


import logging
from ddsc.exceptions import DDSUserException

DUKE_EMAIL_SUFFIX = "@duke.edu"


class UserUtil(object):
    def __init__(self, data_service, logging_func=logging.info):
        self.data_service = data_service
        self.auth_provider_id = data_service.get_default_auth_provider_id()
        self.logging_func = logging_func

    def find_user_by_username(self, username):
        response = self.data_service.get_users(username=username)
        return self._get_single_user_or_none(response, username)

    def register_user_by_username(self, username):

# Path: ddsc/exceptions.py
# class DDSUserException(Exception):
#     """
#     Exception with an error message to be displayed to the user on the command line.
#     """
#     pass


# Path: ddsc/core/userutil.py
import logging
from ddsc.exceptions import DDSUserException


DUKE_EMAIL_SUFFIX = "@duke.edu"


class UserUtil(object):
    def __init__(self, data_service, logging_func=logging.info):
        self.data_service = data_service
        self.auth_provider_id = data_service.get_default_auth_provider_id()
        self.logging_func = logging_func

    def find_user_by_username(self, username):
        response = self.data_service.get_users(username=username)
        return self._get_single_user_or_none(response, username)

    def register_user_by_username(self, username):

        response = self.data_service.auth_provider_add_user(self.auth_provider_id, username)