caterva2.deluser#
- caterva2.deluser(user, urlbase=None, auth_cookie=None)#
Delete a user from the subscriber.
- Parameters:
username¶ (str) – The username of the user to delete.
urlbase¶ (str) – The base of URLs of the subscriber to query. Default is
caterva2.sub_urlbase_default
.auth_cookie¶ (str) – A HTTP cookie for authorizing access. This must be specified unless it was already specified inside a :py_obj:`caterva2.c2context`. The auth_cookie used must be from a superuser.
- Returns:
An explanatory message.
- Return type:
str
Examples
>>> import caterva2 as cat2 >>> import numpy as np >>> # To delete a user you need to be a superuser >>> # This example is intended to work when the subscriber is running locally >>> super_user = {'username': 'superuser@example.com', 'password': 'foo'} >>> super_auth = cat2.get_auth_cookie(cat2.sub_urlbase_default, user_auth=super_user) >>> username = f'user{np.random.randint(0, 100)}@example.com' >>> _ = cat2.adduser(username, 'foo', auth_cookie=super_auth) >>> message = cat2.deluser(username, auth_cookie=super_auth) >>> message == f"User deleted: {username}" True