User

class User(parent=None)

Bases: Item

This class describes an User object child of Item class.

connect(email='', password='', otp_code='')

Sign in a user with its email, password and OTP code

Parameters:
  • email (string) – The email of the user

  • password (string) – The password of the user

  • otp_code (string) – The OTP code provided by the user

Returns:

The result of the sign-in attempt.

Return type:

Dict {user: User}

demote()

Remove admin and super admin privilege.

Returns:

None

forgot_password(aquarium_url=None)

Start forgot password procedure. User will receive an email to reset its password.

Parameters:

aquarium_url (string, optional (default is api_url used during module initialisation)) – The Aquarium Studio interface url. Useful if API url is not the same as Aquarium Studio interface.

Returns:

True or False

Return type:

boolean

get_admin_status()

Return user admin status (None, ‘admin’ or ‘super admin’)

Returns:

Admin status of the user

Return type:

None or ‘admin’ or ‘super admin’

get_current()

Get the current user.

Returns:

User object

Return type:

User

get_profile()

Get the current profil.

Returns:

User, Usergroups and Organisations object

Return type:

Dict {user: User, usergroups: [Usergroup], organisations: [Organisation]}

get_tasks(project_key='', task_status='', task_name='', task_completed=False)

Gets the assigned task of the user

Parameters:
  • project_key (string) – The project key used to filter

  • task_status (string, optional) – The task status used to filter

  • task_name (string, optional) – The task nam used to filtere

  • task_completed (boolean, optional) – Filter the completed tasks

Returns:

List of Task object with there edge

Return type:

List of dict {item: Task, edge: Edge}

promote_as_admin()

Promote the user as admin.

Tip

Admin users can
  • administrate items

  • access administrative panel

Returns:

Membership edge object

Return type:

dict

promote_as_super_admin()

Promote the user as super admin.

Tip

Super admin users can
  • add/remove licenses, users and files

  • administrate items

  • access administrative panel

Returns:

A dict with the {user: participant, edge: the created permission edge}

Return type:

dict

set_data_variables(data={})

Sets the data variables of the User

Parameters:

data (dictionary) – The object item from Aquarium API

signin(email='', password='')

Sign in a user with its email and password

Parameters:
  • email (string) – The email of the user

  • password (string) – The password of the user

Returns:

The result of the sign-in attempt. Result depends if the user enabled or not 2FA.

Return type:

dict

Note

If the user doesn’t have any 2FA method enabled, the return will be like:

{
    "status": "ok",
    "token": "secret_user_token",
    "user": :class:`~aquarium.items.user.User`
}

In case any 2FA method is enabled, the return will be like:

{
    "status": "pending_verification",
    "options": ["otp", "webauthn"],  # Depending on the active options
    "otp": {
        "challenge": "123456",
    },
    "webauthn": {
        "challenge": "123456",
        # ...
    }
}

In this case, you need to call verify_otp() to complete the sign-in process.

signout()

Sign out the current user by clearing the stored authentication token

Note

After a signout(), you need to use a signin() before sending authenticated requests

Returns:

None

verify_otp(email='', challenge='', code='')

Verify the OTP code for 2FA

Parameters:
  • email (string) – The email of the user

  • challenge (string) – The challenge received during the signin process

  • code (string) – The OTP code provided by the user

Returns:

Dictionary User object

Return type:

Dict {user: User}