from django.contrib.auth.backends import ModelBackend

from territories_dashboard_lib.auth_lib.models import ProxyUser


class ProxyUserBackend(ModelBackend):
    def get_user(self, user_id):
        try:
            return ProxyUser.objects.get(pk=user_id)
        except ProxyUser.DoesNotExist:
            return None
