visch
10/12/2022, 4:59 PMvisch
10/12/2022, 4:59 PMdef password(self):
random_chars = list("abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789")
return ''.join(random.choices(random_chars, k=8))
visch
10/12/2022, 4:59 PMdef samaccountname(self, firstname, lastname, preferredname):
if preferredname:
return f"{preferredname}_{lastname}"
else:
return f"{firstname}_{lastname}"
visch
10/12/2022, 5:01 PMdef calculated_active(status, hiredate, employeestatusdate):
date_to_use = hiredate
if hiredate is None: date_to_use = employeestatusdate
if (status == "Active" and (datetime.date.today() >= date_to_use-datetime.timedelta(days=14))) or (
(employeestatusdate == datetime.date.today())):
return True
else:
return False
had to remove some comments and stuff for some of these so it may be hard to get (maybe not)visch
10/12/2022, 5:02 PMdef manager(manager_bamboohr_id, ad_df):
filtered_ad_df = ad_df[ad_df["ad_employeeid"] == manager_bamboohr_id]
if (len(filtered_ad_df)> 1):
print(f"Found more than one match for {manager_bamboohr_id=}, there must be duplicate employeeids in AD")
elif (len(filtered_ad_df) == 1):
return filtered_ad_df["ad_distinguishedname"].values[0]
else:
return None
Here's where we get a little complicatedvisch
10/12/2022, 5:02 PMvisch
10/12/2022, 5:03 PMvisch
10/12/2022, 5:03 PM