user: Extend do_create_user for guest users.

This commit is contained in:
Shubham Dhama
2018-12-30 15:29:33 +05:30
committed by Tim Abbott
parent 235b0db82b
commit 93e3543e5e
2 changed files with 7 additions and 3 deletions

View File

@@ -455,7 +455,8 @@ def create_users(realm: Realm, name_list: Iterable[Tuple[str, str]], bot_type: i
bulk_create_users(realm, user_set, bot_type) bulk_create_users(realm, user_set, bot_type)
def do_create_user(email: str, password: Optional[str], realm: Realm, full_name: str, def do_create_user(email: str, password: Optional[str], realm: Realm, full_name: str,
short_name: str, is_realm_admin: bool=False, bot_type: Optional[int]=None, short_name: str, bot_type: Optional[int]=None,
is_realm_admin: bool=False, is_guest: bool=False,
bot_owner: Optional[UserProfile]=None, tos_version: Optional[str]=None, bot_owner: Optional[UserProfile]=None, tos_version: Optional[str]=None,
timezone: str="", avatar_source: str=UserProfile.AVATAR_FROM_GRAVATAR, timezone: str="", avatar_source: str=UserProfile.AVATAR_FROM_GRAVATAR,
default_sending_stream: Optional[Stream]=None, default_sending_stream: Optional[Stream]=None,
@@ -469,7 +470,7 @@ def do_create_user(email: str, password: Optional[str], realm: Realm, full_name:
user_profile = create_user(email=email, password=password, realm=realm, user_profile = create_user(email=email, password=password, realm=realm,
full_name=full_name, short_name=short_name, full_name=full_name, short_name=short_name,
is_realm_admin=is_realm_admin, is_realm_admin=is_realm_admin, is_guest=is_guest,
bot_type=bot_type, bot_owner=bot_owner, bot_type=bot_type, bot_owner=bot_owner,
tos_version=tos_version, timezone=timezone, avatar_source=avatar_source, tos_version=tos_version, timezone=timezone, avatar_source=avatar_source,
default_sending_stream=default_sending_stream, default_sending_stream=default_sending_stream,

View File

@@ -74,7 +74,9 @@ def create_user_profile(realm: Realm, email: str, password: Optional[str],
def create_user(email: str, password: Optional[str], realm: Realm, def create_user(email: str, password: Optional[str], realm: Realm,
full_name: str, short_name: str, active: bool = True, full_name: str, short_name: str, active: bool = True,
is_realm_admin: bool = False, bot_type: Optional[int] = None, is_realm_admin: bool = False,
is_guest: bool = False,
bot_type: Optional[int] = None,
bot_owner: Optional[UserProfile] = None, bot_owner: Optional[UserProfile] = None,
tos_version: Optional[str] = None, timezone: str = "", tos_version: Optional[str] = None, timezone: str = "",
avatar_source: str = UserProfile.AVATAR_FROM_GRAVATAR, avatar_source: str = UserProfile.AVATAR_FROM_GRAVATAR,
@@ -87,6 +89,7 @@ def create_user(email: str, password: Optional[str], realm: Realm,
full_name, short_name, bot_owner, full_name, short_name, bot_owner,
is_mirror_dummy, tos_version, timezone) is_mirror_dummy, tos_version, timezone)
user_profile.is_realm_admin = is_realm_admin user_profile.is_realm_admin = is_realm_admin
user_profile.is_guest = is_guest
user_profile.avatar_source = avatar_source user_profile.avatar_source = avatar_source
user_profile.timezone = timezone user_profile.timezone = timezone
user_profile.default_sending_stream = default_sending_stream user_profile.default_sending_stream = default_sending_stream