user
#
Description#
Plugin to programmatically create and manage users and user sessions
Configuration#
user:
# No configuration required
Actions#
Module reference#
- 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.
- Returns:
{ "user_id": 1, "username": "test-user", "created_at": "2020-11-26T22:41:40.550574" }
- authenticate_user(username, password)[source]#
Authenticate a user.
- Returns:
True if the provided username and password are correct, False otherwise.
- create_session(username, password, expires_at=None)[source]#
Create a user session.
- Returns:
{ "session_token": "secret", "user_id": 1, "username": "test-user", "created_at": "2020-11-26T22:41:40.550574", "expires_at": "2020-11-26T22:41:40.550574" }
- 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:
{ "user_id": 1, "username": "test-user", "created_at": "2020-11-26T22:41:40.550574" }
- 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" } ]