tik_manager4.objects.user ========================= .. py:module:: tik_manager4.objects.user .. autoapi-nested-parse:: User module for Tik Manager 4. Attributes ---------- .. autoapisummary:: tik_manager4.objects.user.FEED tik_manager4.objects.user.LOG Classes ------- .. autoapisummary:: tik_manager4.objects.user.User tik_manager4.objects.user.UserSettings Module Contents --------------- .. py:class:: User(common_directory=None) User class to handle user data and permissions. .. py:method:: add_project_bookmark(project_path) Add a new project bookmark to the user bookmarks. Args: project_path (str): The project path. Returns: int: 1 if successful, -1 otherwise. .. py:method:: add_recent_commons(commons_path) Add the commons path to the recent commons list. .. py:method:: add_recent_project(path) Add a project to the recent projects list. Args: path (str): The project path. Returns: int: 1 if successful, -1 otherwise. .. py:method:: authenticate(password) Authenticate the active user with the given password. Args: password (str): The password. Returns: tuple: (1, "Success") if successful, (-1, LOG.warning) otherwise. .. py:method:: change_permission_level(user_name, new_level, active_user_password=None) Change the permission level of a user. Args: user_name (str): The user name. new_level (int): The new permission level. active_user_password (str, optional): The password of the active user. If not provided, the user will be authenticated with the hash in the database. Returns: tuple: (1, "Success") if successful, (-1, LOG.warning) otherwise. .. py:method:: change_user_password(old_password, new_password, user_name=None) Change the user password. It only changes the active user, a.k.a needs to be logged in. Args: old_password (str): The old password. new_password (str): The new password. user_name (str, optional): The user name. If not provided, the active user will be used. .. py:method:: check_password(user_name, password) Check the given password against the hashed password. Args: user_name (str): The user name. password (str): The password. Returns: bool: True if the password is correct, False otherwise. .. py:method:: check_permissions(level) Checks the user permissions for project actions. Args: level (int): Permission level to be checked against. Returns: int: 1 if the user has the permission, -1 otherwise. .. py:method:: create_new_user(new_user_name, new_user_initials, new_user_password, permission_level, active_user_password=None, email=None) Create a new user and stores it in database. Args: new_user_name (str): The new user name. new_user_initials (str): The new user initials. new_user_password (str): The new user password. permission_level (int): The permission level. active_user_password (str, optional): The password of the active user. email (str, optional): The email address of the user. Returns: tuple: (1, "Success") if successful, (-1, LOG.warning) otherwise. .. py:method:: delete_project_bookmark(project_path) Delete a project bookmark from the user bookmarks. Args: project_path (str): The project path. Returns: int: 1 if successful, -1 otherwise. .. py:method:: delete_user(user_name, active_user_password=None) Remove the user from database. Args: user_name (str): The user name. active_user_password (str, optional): The password of the active user. If not provided, the user will be authenticated with the hash in the database. Returns: tuple: (1, "Success") if successful, (-1, LOG.warning) otherwise. .. py:method:: get() Return the currently active user. .. py:method:: get_project_bookmarks() Return the user bookmarked projects as list of dictionaries. .. py:method:: get_recent_commons() Return the list of recent commons. .. py:method:: get_recent_projects() Return the list of recent projects. .. py:method:: reset_user_password(new_password, user_name) -> tik_manager4.core.constants.ValidationResult Reset the password for the specified user. This operation can only be performed by users with admin privileges. Args: new_password (str): The new password to assign to the user. user_name (str): The user name. Returns: object: ValidationResult object. .. py:method:: set(user_name, password=None, save_to_db=True, clear_db=False) Set the active user to the session. Args: user_name (str): The user name. password (str, optional): The password. If not provided, the user will be authenticated with the hash in the database. save_to_db (bool, optional): If True, a hash of the user name and password will be saved to the database for auto-login. clear_db (bool, optional): If True the hash will be cleared from the database. Returns: tuple: (1, "Success") if successful, (-1, LOG.warning) otherwise. .. py:property:: bookmark_names Names of the user bookmarks. .. py:property:: column_sizes Column sizes. .. py:property:: email Active User Email. .. py:property:: expanded_subprojects The expansion states of subprojects. .. py:property:: is_authenticated Authentication Status for the active user. .. py:property:: last_category The last category interacted with. .. py:property:: last_project The last project interacted with. .. py:property:: last_subproject The last subproject interacted with. .. py:property:: last_task The last task interacted with. .. py:property:: last_version The last version interacted with. .. py:property:: last_work The last category interacted with. .. py:property:: main_window_state Retrieve the geometric position and scale of the main window. .. py:property:: name Active User Name. .. py:attribute:: object_type .. py:property:: permission_level Permission Level of the active user. .. py:property:: split_sizes The split sizes to apply to the main UI. .. py:property:: ui_elements The GUI elements. .. py:property:: visible_columns The column visibilities. .. py:class:: UserSettings Bases: :py:obj:`tik_manager4.core.settings.Settings` Customized settings for the User class. .. py:method:: apply_settings(force=False) Apply the settings to the file. .. py:data:: FEED .. py:data:: LOG