Ejemplo n.º 1
0
 def task_create_long_term_synergy(**kwargs):
     workflow_task = kwargs["workflow_task"]
     person = TaskWorker.get_person_from_workflow_task(workflow_task)
     # If the 'status' arg is defined, that means the request
     # originated from the front end. We need to check it and
     # see if the user opted to skip over Synergy creation.
     if "status" in kwargs:
         status = kwargs["status"]
         if not status:
             update_field(person, "is_synergy_account_needed", False)
             return ("True", "Success")
     if kwargs["synergy_username"] == "":
         return ("False", "No Synergy username entered.")
     synergy_username = SynergyHelper.verify_synergy_username(
         kwargs["synergy_username"])
     user = TaskWorker.get_user_or_false(kwargs["username"])
     if not user:
         return (False, "Invalid User")
     if not synergy_username:
         return (False, "Synergy user not found")
     did_update = person.update_synergy_service(synergy_username, user)
     if did_update:
         return (True, "Success")
     else:
         return (False, "Unknown Error")
Ejemplo n.º 2
0
def run():
    employees = VisionsHelper.get_employees_for_import()
    for employee in employees:
        new_employee = Employee.objects.create(
            first_name=employee.first_name,
            last_name=employee.last_name,
            ssn=employee.ssn,
            visions_id=employee.id,
            status="visions",
            type="Employee",
        )
    all_employees = Employee.objects.all()
    tandem = User.objects.get(username="******")
    for an_employee in all_employees:
        if an_employee.visions_id:
            # Update demographics from Visions
            an_employee.update_employee_from_visions()
            # Update Synergy username if found
            synergy_username = SynergyHelper.get_synergy_login(
                an_employee.visions_id)
            if synergy_username:
                an_employee.update_synergy_service(synergy_username, tandem)
            # Update Active Directory if found
            ad_username = ldap.get_ad_username_from_visions_id(
                an_employee.visions_id)
            if ad_username:
                an_employee.update_ad_service(ad_username, tandem)
Ejemplo n.º 3
0
def run():
    all_employees = Employee.objects.all()
    tandem = User.objects.get(username="******")
    for an_employee in all_employees:
        if an_employee.visions_id:
            # Update Synergy username if found
            synergy_username = SynergyHelper.get_synergy_login(
                an_employee.visions_id)
            if synergy_username:
                an_employee.update_synergy_service(synergy_username, tandem)
Ejemplo n.º 4
0
 def task_disable_synergy(**kwargs):
     workflow_task = kwargs["workflow_task"]
     employee = TaskWorker.get_employee_from_workflow_task(workflow_task)
     synergy_username = SynergyHelper.get_synergy_login(employee.visions_id)
     user = TaskWorker.get_user_or_false(kwargs["username"])
     if not user:
         return (False, "Invalid User")
     if synergy_username:
         return (False, "Synergy user still active")
     did_update = employee.disable_synergy_service(user)
     if did_update:
         return (True, "Success")
     else:
         return (True, "No Synergy account to disable")
Ejemplo n.º 5
0
 def task_check_synergy(**kwargs):
     workflow_task = kwargs["workflow_task"]
     employee = TaskWorker.get_employee_from_workflow_task(workflow_task)
     if "status" in kwargs:
         status = kwargs["status"]
         if not status:
             update_field(employee, "is_synergy_account_needed", False)
             return ("True", "Success")
     synergy_username = SynergyHelper.get_synergy_login(employee.visions_id)
     user = TaskWorker.get_user_or_false(kwargs["username"])
     if not user:
         return (False, "Invalid User")
     if not synergy_username:
         return (False, "Synergy user not found")
     did_update = employee.update_synergy_service(synergy_username, user)
     if did_update:
         return (True, "Success")
     else:
         return (False, "Unknown Error")
Ejemplo n.º 6
0
 def task_transfer_synergy(**kwargs):
     workflow_task = kwargs["workflow_task"]
     employee = TaskWorker.get_employee_from_workflow_task(workflow_task)
     # If the 'status' arg is defined, that means the request
     # originated from the front end. We need to check it and
     # see if the user opted to skip over Synergy creation.
     if "status" in kwargs:
         status = kwargs["status"]
         if not status:
             update_field(employee, "is_synergy_account_needed", False)
             return ("True", "Success")
     synergy_username = SynergyHelper.get_synergy_login(employee.visions_id)
     user = TaskWorker.get_user_or_false(kwargs["username"])
     if not user:
         return (False, "Invalid User")
     if not synergy_username:
         return (True,
                 "Success. The employee/contractor has no Synergy account.")
     did_update = employee.update_synergy_service(synergy_username, user)
     if did_update:
         return (True, "Success")
     else:
         return (False, "Unknown Error")