Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
577d103
Started implementing the user management API
hiranya911 Jul 13, 2017
94aa617
Implementing more test cases
hiranya911 Jul 13, 2017
e9caf60
Fixing a python 3 test failure
hiranya911 Jul 13, 2017
826cab4
Combined the auth tests into one module
hiranya911 Jul 13, 2017
f86c0b4
Implemented the rest of the user management API
hiranya911 Jul 13, 2017
3be855a
Implemented more unit tests for user management API
hiranya911 Jul 13, 2017
def74cd
Updated API docs
hiranya911 Jul 13, 2017
ba3dca7
Implemented phone number auth support
hiranya911 Jul 13, 2017
37724ae
Stricter validation for arguments
hiranya911 Jul 13, 2017
15efd0a
Added more tests
hiranya911 Jul 13, 2017
8235199
Improved test coverage
hiranya911 Jul 13, 2017
c91d415
Updated user management tests
hiranya911 Jul 14, 2017
52ab376
Test cases for valid phone numbers
hiranya911 Jul 18, 2017
7242fef
Updated error message
hiranya911 Jul 21, 2017
06f3745
Updated create_user() and update_user() to accept kwargs instead of d…
hiranya911 Jul 26, 2017
e64bc09
Merge branch 'master' into hkj-user-mgt
hiranya911 Jul 26, 2017
24a4c06
Updated documentation
hiranya911 Jul 27, 2017
d2f76cf
Refactoring code by merging some redundant lines
hiranya911 Aug 1, 2017
6b1e1b4
Extract user managemnt code into a separate helper module
hiranya911 Aug 1, 2017
ad4d7b7
Using constants in test code
hiranya911 Aug 1, 2017
fcec67b
Fixing a typo
hiranya911 Aug 2, 2017
7aa00ef
Merging with master (resolved conflicts in test_db.py)
hiranya911 Aug 11, 2017
c0f8076
Merge branch 'hkj-user-mgt' of github.com:firebase/firebase-admin-pyt…
hiranya911 Aug 11, 2017
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated API docs
  • Loading branch information
hiranya911 committed Jul 13, 2017
commit def74cdfbd43a0f39e4429c8b90bfbaec13bec06
56 changes: 56 additions & 0 deletions firebase_admin/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,31 @@ class UserInfo(object):

@property
def uid(self):
"""Returns the user ID of this user."""
raise NotImplementedError

@property
def display_name(self):
"""Returns the display name of this user."""
raise NotImplementedError

@property
def email(self):
"""Returns the email address associated with this user."""
raise NotImplementedError

@property
def photo_url(self):
"""Returns the photo URL of this user."""
raise NotImplementedError

@property
def provider_id(self):
"""Returns the ID of the identity provider.

This can be a short domain name (e.g. google.com), or the identity of an OpenID
identity provider.
"""
raise NotImplementedError


Expand All @@ -236,38 +245,85 @@ def __init__(self, data):

@property
def uid(self):
"""Returns the user ID of this user.

Returns:
string: A user ID string. This value is never None or empty.
"""
return self._data.get('localId')

@property
def display_name(self):
"""Returns the display name of this user.

Returns:
string: A display name string or None.
"""
return self._data.get('displayName')

@property
def email(self):
"""Returns the email address associated with this user.

Returns:
string: An email address string or None.
"""
return self._data.get('email')

@property
def photo_url(self):
"""Returns the photo URL of this user.

Returns:
string: A URL string or None.
"""
return self._data.get('photoUrl')

@property
def provider_id(self):
"""Returns the provider ID of this user.

Returns:
string: A constant provider ID value.
"""
return 'firebase'

@property
def email_verified(self):
"""Returns whether the email address of this user has been verified.

Returns:
bool: True if the email has been verified, and False otherwise.
"""
return bool(self._data.get('emailVerified'))

@property
def disabled(self):
"""Returns whether this user account is disabled.

Returns:
bool: True if the user account is disabled, and False otherwise.
"""
return bool(self._data.get('disabled'))

@property
def user_metadata(self):
"""Returns additional metadata associated with this user.

Returns:
UserMetadata: A UserMetadata instance. Does not return None.
"""
return UserMetadata(self._data)

@property
def provider_data(self):
"""Returns a list of UserInfo instances.

Each object represents an identity from an identity provider that is linked to this user.

Returns:
list: A list of UserInfo objects, which may be empty.
"""
providers = self._data.get('providerUserInfo', [])
return [_ProviderUserInfo(entry) for entry in providers]

Expand Down