X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FUpdatePerson.py;h=1874f1344b50f0c71b91e425960a9f952ecf534c;hb=465305e5d5738d3fde3121a8d92d31db6c77871b;hp=b85cc6401cde3962f96c118b1c2adf2feca8031f;hpb=6b43fdd7c56905a85f89f90e390104be4da480ed;p=plcapi.git diff --git a/PLC/Methods/UpdatePerson.py b/PLC/Methods/UpdatePerson.py index b85cc64..1874f13 100644 --- a/PLC/Methods/UpdatePerson.py +++ b/PLC/Methods/UpdatePerson.py @@ -7,6 +7,7 @@ from PLC.Persons import Person, Persons from PLC.sendmail import sendmail from PLC.TagTypes import TagTypes from PLC.PersonTags import PersonTags, PersonTag +from PLC.Namespace import email_to_hrn related_fields = Person.related_fields.keys() can_update = ['first_name', 'last_name', 'title', 'email', @@ -85,6 +86,14 @@ class UpdatePerson(Method): Body = "Your %s account has been disabled. Please contact your PI or PlanetLab support for more information" % (self.api.config.PLC_NAME) sendmail(self.api, To = To, Cc = Cc, Subject = Subject, Body = Body) + # if email was modifed make sure to update the hrn tag + if 'email' in native: + old_hrn=PersonTags(self.api,{'tagname':'hrn','person_id':person['person_id']})[0]['value'] + if old_hrn : + root_auth = self.api.config.PLC_HRN_ROOT + login_base = old_hrn.split('.')[-2] + hrn=email_to_hrn("%s.%s"%(root_auth,login_base),person['email']) + tags['hrn'] = hrn for (tagname,value) in tags.iteritems(): # the tagtype instance is assumed to exist, just check that