def set_current_person(person): """Set user as the current `Person`.""" user = entity.PersonEntity(id=person.obj_id, name=person.name, email=person.email, system_wide_role=person.global_role_name) set_current_user(user)
def _create_random_person(cls): """Create Person entity with randomly filled fields.""" random_person = entity.PersonEntity() random_person.type = cls.obj_person random_person.name = cls.generate_string(cls.obj_person) random_person.email = cls.generate_email() random_person.system_wide_role = roles.SUPERUSER return random_person
def _create_random_person(cls): """Create Person entity with randomly filled fields.""" random_person = entity.PersonEntity() random_person.title = cls.generate_title(cls.obj_person) random_person.type = cls.obj_person random_person.email = cls.generate_email() random_person.authorizations = roles.NO_ROLE return random_person
# Copyright (C) 2018 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Constants related to people objects""" from lib.entities import entity DEFAULT_EMAIL_DOMAIN = "example.com" MIGRATOR_USER_EMAIL = "migrator@" + DEFAULT_EMAIL_DOMAIN FAKE_SUPER_USER = entity.PersonEntity(email="user@" + DEFAULT_EMAIL_DOMAIN) UI_USER = "******" _current_user = None # pylint: disable=invalid-name _logged_in_user_tracks = {} # pylint: disable=invalid-name def set_current_user(user): """Set user as the current user""" print "Set user: {}".format(user) # pylint: disable=invalid-name, global-statement global _current_user _current_user = user def current_user(): """Get current user""" return _current_user def set_current_person(person): """Set user as the current `Person`."""
# Copyright (C) 2019 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Constants related to people objects""" from lib.entities import entity DEFAULT_EMAIL_DOMAIN = "example.com" MIGRATOR_USER_EMAIL = "migrator@" + DEFAULT_EMAIL_DOMAIN EXTERNAL_APP_USER = entity.PersonEntity( email="external_app@" + DEFAULT_EMAIL_DOMAIN) FAKE_SUPER_USER = entity.PersonEntity(email="user@" + DEFAULT_EMAIL_DOMAIN) UI_USER = "******" _current_user = None # pylint: disable=invalid-name _logged_in_user_tracks = {} # pylint: disable=invalid-name def set_current_user(user): """Set user as the current user""" print "Set user: {}".format(user) # pylint: disable=invalid-name, global-statement global _current_user _current_user = user def current_user(): """Get current user""" return _current_user def set_current_person(person):