Skip to content

Commit

Permalink
[IMP] Starting to separate business layer from REST layer. The busine…
Browse files Browse the repository at this point in the history
…ss layer will be common to REST and GraphQL and include permission checks
  • Loading branch information
c8y3 committed Mar 19, 2024
1 parent fb03df8 commit 0a61f44
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
12 changes: 4 additions & 8 deletions source/app/blueprints/manage/manage_cases_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,36 +49,32 @@
from app.datamgmt.manage.manage_case_templates_db import get_case_templates_list, case_template_pre_modifier, \
case_template_post_modifier
from app.datamgmt.manage.manage_cases_db import close_case, map_alert_resolution_to_case_status, get_filtered_cases
from app.datamgmt.manage.manage_cases_db import delete_case
from app.datamgmt.manage.manage_cases_db import get_case_details_rt
from app.datamgmt.manage.manage_cases_db import get_case_protagonists
from app.datamgmt.manage.manage_cases_db import list_cases_dict
from app.datamgmt.manage.manage_cases_db import reopen_case
from app.datamgmt.manage.manage_common import get_severities_list
from app.datamgmt.manage.manage_users_db import get_user_organisations
from app.forms import AddCaseForm
from app.iris_engine.access_control.utils import ac_fast_check_current_user_has_case_access, \
ac_current_user_has_permission
from app.iris_engine.access_control.utils import ac_fast_check_user_has_case_access
from app.iris_engine.access_control.utils import ac_set_new_case_access
from app.iris_engine.module_handler.module_handler import call_modules_hook
from app.iris_engine.module_handler.module_handler import configure_module_on_init
from app.iris_engine.module_handler.module_handler import instantiate_module_from_name
from app.iris_engine.tasker.tasks import task_case_update
from app.iris_engine.utils.common import build_upload_path
from app.iris_engine.utils.tracker import track_activity
from app.models.alerts import AlertStatus
from app.models.authorization import CaseAccessLevel
from app.models.authorization import Permissions
from app.models.models import Client, ReviewStatusList
from app.models.models import ReviewStatusList
from app.schema.marshables import CaseSchema, CaseDetailsSchema
from app.util import ac_api_case_requires, add_obj_history_entry
from app.util import add_obj_history_entry
from app.util import ac_api_requires
from app.util import ac_api_return_access_denied
from app.util import ac_case_requires
from app.util import ac_requires
from app.util import response_error
from app.util import response_success
from app.business.cases import delete

manage_cases_blueprint = Blueprint('manage_case',
__name__,
Expand Down Expand Up @@ -250,7 +246,7 @@ def api_delete_case(cur_id, caseid):
else:
try:
call_modules_hook('on_preload_case_delete', data=cur_id, caseid=caseid)
if delete_case(case_id=cur_id):
if delete(cur_id):

call_modules_hook('on_postload_case_delete', data=cur_id, caseid=caseid)

Expand Down
Empty file added source/app/business/__init__.py
Empty file.
23 changes: 23 additions & 0 deletions source/app/business/cases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# IRIS Source Code
# Copyright (C) 2024 - DFIR-IRIS
# [email protected]
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from app.datamgmt.manage.manage_cases_db import delete_case


def delete(identifier):
return delete_case(identifier)

0 comments on commit 0a61f44

Please sign in to comment.