Beispiel #1
0
from service.sofd_setup.orgunit_uuid_service import Orgunit_uuid_service
from service.sofd_setup.feriesaldo_service import Feriesaldo_service
from service.queues.orgunit_queue_service import Orgunit_queue_service
from service.queues.user_queue_service import User_queue_service
from service.sofd_setup.sbsys_extensions_service import Sbsys_extensions_service
from service.sofd_setup.unic_to_position_service import Unic_to_position_service
'''
python app that handles the manager reference setup after the opus_xml_to_sofd has run.
author - Jacob Ågård Bennike
Skanderborg Kommune 2019
'''
# Vi har vores hemmelige værdier i en .env fil, hvis du skal bruge scriptet skal du have styr på disse.
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
# starter vores e-mail service - henter smtp informationer fra .env fil
es = Email_service(os.environ.get('smtp_username'),
                   os.environ.get('smtp_password'),
                   os.environ.get('smtp_server'), os.environ.get('smtp_port'))
error_email = os.environ.get('error_email')
step = 'starting'

# connection string til SOFD databasen
constr_lora = os.environ.get('constr_lora')
step = 'setup complete'

# user_position_service skal eksekveres før manager setup fordi managerset up henter uuider som reference til leder
user_position_service = User_position_service(constr_lora)
step = 'user_position_service'
user_position_service.link_user_to_position()
step = 'user_position_service.link_user_to_position() complete'
from mox_clients.os2rollekatalog.os2rollekatalog_sync_service import Os2rollekatalog_sync_service
from service.email_service import Email_service
'''
Mox klient som synkroniserer org data med OS2Rollekataloget.
'''
# henter variable fra .env filen
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
constr_lora = os.environ.get('constr_lora')
api_key = os.environ.get('os2rollekatalog_apikey')
endpointurl = os.environ.get('os2rollekatalog_endpointurl')
error_email = os.environ.get('error_email')

# email service
es = Email_service(os.environ.get('smtp_username'),
                   os.environ.get('smtp_password'),
                   os.environ.get('smtp_server'), os.environ.get('smtp_port'))

# kører service
try:
    oss = Os2rollekatalog_sync_service(constr_lora)
    step = 'Json'
    json_str = oss.create_org_json()
    step = 'api'
    status_code = oss.post_json(endpointurl, api_key, json_str)
    step = 'status_code'
    if status_code != 200:
        es.send_mail(error_email,
                     'Error: mox_os2rollekatalog_sync.py python app',
                     'Step = ' + step + ': ' + status_code)
except Exception as e:
Beispiel #3
0
from os.path import join, dirname
from dotenv import load_dotenv
import glob
from mox_clients.kmdi2_sync.kmdi2_employee_api import Kmdi2_employee_api
from mox_clients.kmdi2_sync.kmd_institution_api import Kmd_institution_api
from mox_clients.kmdi2_sync.kmdi2_service import Kmdi2_service
from service.email_service import Email_service

# Vi har vores hemmelige værdier i en .env fil, hvis du skal bruge scriptet skal du have styr på disse.
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
# starter vores e-mail service - henter smtp informationer fra .env fil
kmdi2_test_key = os.environ.get('kmdi2_test_key')
kmdi2_employee_api_key = os.environ.get('kmdi2_employee_api_key')
kmdi2_api_key = os.environ.get('kmdi2_api_key')

#email setup
es = Email_service(os.environ.get('smtp_username'), os.environ.get(
    'smtp_password'), os.environ.get('smtp_server'), os.environ.get('smtp_port'))
error_email = os.environ.get('error_email')

try:
    add_employee_url = os.environ.get('kmdi2_employee_api_endpoint') + 'employment/institution/'
    delete_employee_url = os.environ.get('kmdi2_employee_api_delete_endpoint')
    get_employements_url = os.environ.get('kmdi2_employee_api_endpoint') + "employments"
    constr_lora = os.environ.get('constr_lora')
    kmdi2_service = Kmdi2_service(constr_lora)
    kmdi2_service.sync_employees_with_kmdi2(kmdi2_employee_api_key, add_employee_url, get_employements_url, delete_employee_url)
except Exception as e:
    es.send_mail(error_email,
                 'Error: mox_kmdi2_sync.py python app', 'Exception: ' + str(e))
Beispiel #4
0
from service.sofd_setup.feriesaldo_service import Feriesaldo_service
from service.queues.orgunit_queue_service import Orgunit_queue_service
from service.queues.user_queue_service import User_queue_service
from service.sofd_setup.sbsys_extensions_service import Sbsys_extensions_service
from service.sofd_setup.unic_to_position_service import Unic_to_position_service
'''
python app that handles the manager reference setup after the opus_xml_to_sofd has run.
author - Jacob Ågård Bennike
Skanderborg Kommune 2019
'''
# Vi har vores hemmelige værdier i en .env fil, hvis du skal bruge scriptet skal du have styr på disse.
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
# starter vores e-mail service - henter smtp informationer fra .env fil
es = Email_service(os.environ.get('smtp_username'),
                   os.environ.get('smtp_password'),
                   os.environ.get('smtp_server'), os.environ.get('smtp_port'))
error_email = os.environ.get('error_email')
step = 'starting'

# connection string til SOFD databasen
constr_lora = os.environ.get('constr_lora')
step = 'setup complete'
try:
    # tilføjer UUID'er til orgunits, tilføjer bagefter deres parent UUID
    orgunit_uuid_service = Orgunit_uuid_service(constr_lora)
    step = 'orgunit_uuid_service.set_parent_uuids() started'
    orgunit_uuid_service.set_orgunit_uuid()
    step = 'org_service.set_orgunit_uuid() started'
    orgunit_uuid_service.set_parent_uuids()