'Loads all contents of the folder (folders and data sets) but only
in the first level. Include deleted if the flag is set and if the
user has access to undelete it.
:param  folder:          the folder which contents are being loaded
:type   folder:          Galaxy LibraryFolder
:param  include_deleted: flag, when true the items that are deleted
and can be undeleted by current user are shown
:type   include_deleted: boolean
:returns:   a list containing the requested items
:type:      list'

def _load_folder_contents(self, trans, folder, include_deleted):

    current_user_roles = trans.get_current_user_roles()
    is_admin = trans.user_is_admin()
    content_items = []
    for subfolder in folder.folders:
        if subfolder.deleted:
            if include_deleted:
                if is_admin:
                    subfolder.api_type = 'folder'
                    content_items.append(subfolder)
                else:
                    can_modify = trans.app.security_agent.can_modify_library_item(current_user_roles, subfolder)
                    if can_modify:
                        subfolder.api_type = 'folder'
                        content_items.append(subfolder)
        else:
            subfolder.api_type = 'folder'
            content_items.append(subfolder)
    for dataset in folder.datasets:
        if dataset.deleted:
            if include_deleted:
                if is_admin:
                    dataset.api_type = 'file'
                    content_items.append(dataset)
                else:
                    can_modify = trans.app.security_agent.can_modify_library_item(current_user_roles, dataset)
                    if can_modify:
                        dataset.api_type = 'file'
                        content_items.append(dataset)
        elif is_admin:
            dataset.api_type = 'file'
            content_items.append(dataset)
        else:
            can_access = trans.app.security_agent.can_access_dataset(current_user_roles, dataset.library_dataset_dataset_association.dataset)
            if can_access:
                dataset.api_type = 'file'
                content_items.append(dataset)
    return content_items
