def test_log_manager(self): ex = exception_factory.apply() sm = user_iam_factory.apply(ex) lm = lm_factory.apply(ex) lm.set_user_management(sm) all_sessions = sm.get_all_sessions() lm.remove_unneeded_sessions(all_sessions) lm.get_handlers() lm.check_is_admin("admin") lm.check_user_log_visibility("admin", "receipt") lm.check_user_enabled_upload("user1") lm.check_user_enabled_upload("user2") lm.check_user_enabled_download("user1", "receipt") lm.check_user_enabled_download("user2", "running-example") lm.load_log_static("receipt", "logs/receipt.parquet") lm.load_log_static("receipt", "logs/receipt.xes") lm.save_object_memory("ciao", "ciao") var = lm.get_object_memory("ciao") lm.get_user_eventlog_vis_down_remov() lm.add_user_eventlog_visibility("admin", "receipt") lm.remove_user_eventlog_visibility("admin", "receipt") lm.add_user_eventlog_downloadable("admin", "receipt") lm.remove_user_eventlog_downloadable("admin", "receipt") lm.add_user_eventlog_removable("admin", "receipt") lm.remove_user_eventlog_removable("admin", "receipt")
def test_session(self): ex = exception_factory.apply() sm = user_iam_factory.apply(ex) session = sm.do_login("admin", "admin") sm.check_session_validity(session) sm.get_user_from_session(session) sm.clean_expired_sessions() sm.get_all_sessions() sm.get_all_users()
import traceback from threading import Semaphore from flask import Flask, request, jsonify from flask_cors import CORS from pm4pyws.configuration import Configuration from pm4pyws.log_manager import factory as session_manager_factory from pm4pyws.user_iam import factory as user_iam_factory from pm4pyws.requests_logging import factory as logging_factory from pm4pyws.util import constants import logging ex = logging_factory.apply() um = user_iam_factory.apply(ex) lh = session_manager_factory.apply(ex) lh.set_user_management(um) class Commons: semaphore_matplot = Semaphore(1) def clean_expired_sessions(): """ Cleans expired sessions """ um.clean_expired_sessions() sessions = um.get_all_sessions() lh.remove_unneeded_sessions(sessions)