Only change group membership if cert changes
This commit is contained in:
parent
440d389f16
commit
ddb83a1b58
|
@ -197,12 +197,16 @@ class AdminMemberSerializer(MemberSerializer):
|
||||||
|
|
||||||
def update(self, instance, validated_data):
|
def update(self, instance, validated_data):
|
||||||
if 'rabbit_cert_date' in validated_data:
|
if 'rabbit_cert_date' in validated_data:
|
||||||
|
changed = validated_data['rabbit_cert_date'] != instance.rabbit_cert_date
|
||||||
|
if changed:
|
||||||
if validated_data['rabbit_cert_date']:
|
if validated_data['rabbit_cert_date']:
|
||||||
utils_ldap.add_to_group(instance, 'Laser Users')
|
utils_ldap.add_to_group(instance, 'Laser Users')
|
||||||
else:
|
else:
|
||||||
utils_ldap.remove_from_group(instance, 'Laser Users')
|
utils_ldap.remove_from_group(instance, 'Laser Users')
|
||||||
|
|
||||||
if 'trotec_cert_date' in validated_data:
|
if 'trotec_cert_date' in validated_data:
|
||||||
|
changed = validated_data['trotec_cert_date'] != instance.trotec_cert_date
|
||||||
|
if changed:
|
||||||
if validated_data['trotec_cert_date']:
|
if validated_data['trotec_cert_date']:
|
||||||
utils_ldap.add_to_group(instance, 'Trotec Users')
|
utils_ldap.add_to_group(instance, 'Trotec Users')
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user