log_manager = current_app.log_manager user_manager = current_app.user_manager try: from cmdb.utils.error import CMDBError except ImportError: CMDBError = Exception LOGGER = logging.getLogger(__name__) object_blueprint = RootBlueprint('object_blueprint', __name__, url_prefix='/object') with current_app.app_context(): from cmdb.interface.rest_api.framework_routes.object_link_routes import link_rest object_blueprint.register_nested_blueprint(link_rest) # DEFAULT ROUTES @object_blueprint.route('/', methods=['GET']) @login_required @insert_request_user @right_required('base.framework.object.view') def get_object_list(request_user: User): """ get all objects in database Args: request_user: auto inserted user who made the request. Returns: list of rendered objects
from cmdb.utils.system_reader import SystemSettingsReader LOGGER = logging.getLogger(__name__) try: from cmdb.utils.error import CMDBError except ImportError: CMDBError = Exception settings_blueprint = RootBlueprint('settings_rest', __name__, url_prefix='/settings') with current_app.app_context(): from cmdb.interface.rest_api.settings_routes.system_routes import system_blueprint settings_blueprint.register_nested_blueprint(system_blueprint) system_settings_reader = SystemSettingsReader( database_manager=current_app.database_manager) @settings_blueprint.route('/<string:section>/', methods=['GET']) @settings_blueprint.route('/<string:section>', methods=['GET']) @login_required @insert_request_user @right_required('base.system.view') def get_settings_from_section(section: str, request_user: User): section_settings = system_settings_reader.get_all_values_from_section( section=section) if len(section_settings) < 1: return make_response([], 204)
# DATAGERRY - OpenSource Enterprise CMDB # Copyright (C) 2019 - 2021 NETHINKS GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. from flask import current_app from cmdb.interface.blueprint import RootBlueprint importer_blueprint = RootBlueprint('import_rest', __name__, url_prefix='/import') with current_app.app_context(): from cmdb.interface.rest_api.importer_routes.importer_object_routes import importer_object_blueprint importer_blueprint.register_nested_blueprint(importer_object_blueprint) from cmdb.interface.rest_api.importer_routes.importer_type_routes import importer_type_blueprint importer_blueprint.register_nested_blueprint(importer_type_blueprint)