Don't change ldap group membership if it's not configured
This commit is contained in:
parent
ced94ae019
commit
8d82b7e85b
|
@ -217,17 +217,19 @@ class TrainingViewSet(Base, Retrieve, Create, Update):
|
||||||
elif session.course.id == 247:
|
elif session.course.id == 247:
|
||||||
member.rabbit_cert_date = utils.today_alberta_tz() if status == 'Attended' else None
|
member.rabbit_cert_date = utils.today_alberta_tz() if status == 'Attended' else None
|
||||||
|
|
||||||
if status == 'Attended':
|
if utils_ldap.is_configured():
|
||||||
utils_ldap.add_to_group(member, 'Laser Users')
|
if status == 'Attended':
|
||||||
else:
|
utils_ldap.add_to_group(member, 'Laser Users')
|
||||||
utils_ldap.remove_from_group(member, 'Laser Users')
|
else:
|
||||||
|
utils_ldap.remove_from_group(member, 'Laser Users')
|
||||||
elif session.course.id == 321:
|
elif session.course.id == 321:
|
||||||
member.trotec_cert_date = utils.today_alberta_tz() if status == 'Attended' else None
|
member.trotec_cert_date = utils.today_alberta_tz() if status == 'Attended' else None
|
||||||
|
|
||||||
if status == 'Attended':
|
if utils_ldap.is_configured():
|
||||||
utils_ldap.add_to_group(member, 'Trotec Users')
|
if status == 'Attended':
|
||||||
else:
|
utils_ldap.add_to_group(member, 'Trotec Users')
|
||||||
utils_ldap.remove_from_group(member, 'Trotec Users')
|
else:
|
||||||
|
utils_ldap.remove_from_group(member, 'Trotec Users')
|
||||||
member.save()
|
member.save()
|
||||||
|
|
||||||
# TODO: turn these into @actions
|
# TODO: turn these into @actions
|
||||||
|
|
Loading…
Reference in New Issue
Block a user