Add location metadata field for users
This commit is contained in:
parent
cc26eefd2f
commit
3de6b4a646
9 changed files with 68 additions and 10 deletions
|
@ -381,12 +381,15 @@ def list_entity_robot_permission_teams(entity_name, include_permissions=False):
|
|||
return TupleSelector(query, fields)
|
||||
|
||||
|
||||
def update_user_metadata(user, given_name=None, family_name=None, company=None):
|
||||
def update_user_metadata(user, metadata=None):
|
||||
""" Updates the metadata associated with the user, including his/her name and company. """
|
||||
metadata = metadata if metadata is not None else {}
|
||||
|
||||
with db_transaction():
|
||||
user.given_name = given_name or user.given_name
|
||||
user.family_name = family_name or user.family_name
|
||||
user.company = company or user.company
|
||||
user.given_name = metadata.get('given_name') or user.given_name
|
||||
user.family_name = metadata.get('family_name') or user.family_name
|
||||
user.company = metadata.get('company') or user.company
|
||||
user.location = metadata.get('location') or user.location
|
||||
user.save()
|
||||
|
||||
# Remove any prompts associated with the user's metadata being needed.
|
||||
|
|
Reference in a new issue