def user_loader(user_id): """Returns the auth user by user_id""" from ggrc.utils.user_generator import find_user_by_id user = find_user_by_id(user_id) if user and settings.DEBUG: from google.appengine.api import users try: ae_user = users.get_current_user() except AssertionError: ae_user = None if ae_user and ae_user.email() != user.email: return None return user
def deserialize(self, value): """Deserialize json representation to Person object. Creates non existing person if force_create attribute is True. """ from ggrc.utils import user_generator if value.get("email"): email = value.get("email") name = value.get("name") if self.force_create: return user_generator.find_or_create_external_user(email, name) return user_generator.find_user_by_email(email) elif value.get("id"): return user_generator.find_user_by_id(value["id"]) else: raise ValueError("Provided data are incorrect.")
def user_loader(user_id): from ggrc.utils.user_generator import find_user_by_id return find_user_by_id(user_id)
def user_loader(user_id): from ggrc.utils.user_generator import find_user_by_id return find_user_by_id(user_id)