user
Platypush documentation
user
- class platypush.plugins.user.UserPlugin(**kwargs)[source]
Bases:
Plugin
Plugin to programmatically create and manage users and user sessions
- authenticate_session(session_token)[source]
Authenticate a session by token and return the associated user :return: dict.
Format:
{ "user_id": int, "username": str, "created_at": str (in ISO format) }
- authenticate_user(username, password)[source]
Authenticate a user :return: True if the provided username and password are correct, False otherwise
- create_session(username, password, expires_at=None)[source]
Create a user session :return: dict:
{ "session_token": str, "user_id": int, "created_at": str (in ISO format), "expires_at": str (in ISO format), }
- create_user(username, password, executing_user=None, executing_user_password=None, session_token=None, **kwargs)[source]
- Create a user. This action needs to be executed by an already existing user, who needs to authenticate with
their own credentials, unless this is the first user created on the system.
- Returns:
dict.
Format:
{ "user_id": int, "username": str, "created_at": str (in ISO format) }
- delete_user(username, executing_user=None, executing_user_password=None, session_token=None)[source]
Delete a user
- get_user_by_session(session_token: str) dict [source]
Get the user record associated to a session token.
- Parameters:
session_token – Session token.
- Returns:
[ { "user_id": 1, "username": "user1", "created_at": "2020-11-26T22:41:40.550574" } ]