gui/backend/gui_plugin/modules/Modules.py
def move_data(id, tree_identifier, linked_to, link_id, source_path, target_path, web_session=None):
    """Moves data from source path to target path.

    Args:
        id (int): The id of the data
        tree_identifier (str): The identifier of the tree
        linked_to (str): ['profile'|'group']
        link_id (int): The profile id or the group id (depending on linked_to)
        source_path (str): The source folder path f.e. "/scripts/server1"
        target_path (str): The target folder path f.e. "/scripts/server2"
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The id of the moved record.
    """
    if linked_to not in ['profile', 'group']:
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'linked_to' can only take value 'profile' or 'group'.")

    if tree_identifier.strip() == "":
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'tree_identifier' cannot be empty.")

    if source_path.strip() == "" or source_path.strip() == "/":
        source_path = None

    if target_path.strip() == "" or target_path.strip() == "/":
        target_path = None

    if source_path == target_path:
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameters 'source_path' and 'target_path' are the same.")

    with BackendDatabase(web_session) as db:
        with BackendTransaction(db):
            root_folder_id = backend.get_root_folder_id(db, tree_identifier, linked_to, link_id)

            if root_folder_id is None:
                raise MSGException(Error.CORE_INVALID_PARAMETER, f"Cannot find root folder id for the given 'tree_identifier'.")

            source_folder_id = backend.get_folder_id(db, root_folder_id, source_path)
            if source_folder_id is None:
                raise MSGException(Error.CORE_INVALID_PARAMETER, f"Cannot find the given 'source_path'.")
            target_folder_id = backend.get_folder_id(db, root_folder_id, target_path)

            if target_folder_id is None:
                target_folder_id, _ = backend.create_folder(db, target_path, root_folder_id)

            backend.add_data_to_folder(db, id, target_folder_id, read_only=0)

            return backend.delete_data(db, id, source_folder_id)
Moves data from source path to target path.

    Args:
        id (int): The id of the data
        tree_identifier (str): The identifier of the tree
        linked_to (str): ['profile'|'group']
        link_id (int): The profile id or the group id (depending on linked_to)
        source_path (str): The source folder path f.e. "/scripts/server1"
        target_path (str): The target folder path f.e. "/scripts/server2"
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The id of the moved record.
    
Moves data from source path to target path.
Moves data from source path to target path .
def move_data(id, tree_identifier, linked_to, link_id, source_path, target_path, web_session=None):
    if linked_to not in ['profile', 'group']:
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'linked_to' can only take value 'profile' or 'group'.")
    if tree_identifier.strip() == "":
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'tree_identifier' cannot be empty.")
    if source_path.strip() == "" or source_path.strip() == "/":
        source_path = None
    if target_path.strip() == "" or target_path.strip() == "/":
        target_path = None
    if source_path == target_path:
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameters 'source_path' and 'target_path' are the same.")
    with BackendDatabase(web_session) as db:
        with BackendTransaction(db):
            root_folder_id = backend.get_root_folder_id(db, tree_identifier, linked_to, link_id)
            if root_folder_id is None:
                raise MSGException(Error.CORE_INVALID_PARAMETER, f"Cannot find root folder id for the given 'tree_identifier'.")
            source_folder_id = backend.get_folder_id(db, root_folder_id, source_path)
            if source_folder_id is None:
                raise MSGException(Error.CORE_INVALID_PARAMETER, f"Cannot find the given 'source_path'.")
            target_folder_id = backend.get_folder_id(db, root_folder_id, target_path)
            if target_folder_id is None:
                target_folder_id, _ = backend.create_folder(db, target_path, root_folder_id)
            backend.add_data_to_folder(db, id, target_folder_id, read_only=0)
            return backend.delete_data(db, id, source_folder_id)
def move_data ( id , tree_identifier , linked_to , link_id , source_path , target_path , web_session = None ) : if linked_to not in [ 'profile' , 'group' ] : raise MSGException ( Error . CORE_INVALID_PARAMETER , f"Parameter 'linked_to' can only take value 'profile' or 'group'." ) if tree_identifier . strip ( ) == "" : raise MSGException ( Error . CORE_INVALID_PARAMETER , f"Parameter 'tree_identifier' cannot be empty." ) if source_path . strip ( ) == "" or source_path . strip ( ) == "/" : source_path = None if target_path . strip ( ) == "" or target_path . strip ( ) == "/" : target_path = None if source_path == target_path : raise MSGException ( Error . CORE_INVALID_PARAMETER , f"Parameters 'source_path' and 'target_path' are the same." ) with BackendDatabase ( web_session ) as db : with BackendTransaction ( db ) : root_folder_id = backend . get_root_folder_id ( db , tree_identifier , linked_to , link_id ) if root_folder_id is None : raise MSGException ( Error . CORE_INVALID_PARAMETER , f"Cannot find root folder id for the given 'tree_identifier'." ) source_folder_id = backend . get_folder_id ( db , root_folder_id , source_path ) if source_folder_id is None : raise MSGException ( Error . CORE_INVALID_PARAMETER , f"Cannot find the given 'source_path'." ) target_folder_id = backend . get_folder_id ( db , root_folder_id , target_path ) if target_folder_id is None : target_folder_id , _ = backend . create_folder ( db , target_path , root_folder_id ) backend . add_data_to_folder ( db , id , target_folder_id , read_only = 0 ) return backend . delete_data ( db , id , source_folder_id )
Moves data from source path to target path.
Moves data from source path to target path .
"""Moves data from source path to target path.

    Args:
        id (int): The id of the data
        tree_identifier (str): The identifier of the tree
        linked_to (str): ['profile'|'group']
        link_id (int): The profile id or the group id (depending on linked_to)
        source_path (str): The source folder path f.e. "/scripts/server1"
        target_path (str): The target folder path f.e. "/scripts/server2"
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The id of the moved record.
    """
The id of the moved record.
The id of the moved record .
id
The id of the data
The id of the data
tree_identifier
The identifier of the tree
The identifier of the tree
linked_to
None
link_id
The profile id or the group id (depending on linked_to)
The profile id or the group id ( depending on linked_to )
source_path
The source folder path f.e. "/scripts/server1"
The source folder path f . e . " / scripts / server1 "
target_path
The target folder path f.e. "/scripts/server2"
The target folder path f . e . " / scripts / server2 "
web_session
The webserver session object, optional. Will be
passed in my the webserver automatically
The webserver session object optional . Will be passed in my the webserver automatically