git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6b43fdd
)
Update Person HRN when Person's email is updated
author
Mohamed Larabi
<mohamed.larabi@inria.fr>
Thu, 14 Nov 2013 16:46:10 +0000
(17:46 +0100)
committer
Mohamed Larabi
<mohamed.larabi@inria.fr>
Thu, 14 Nov 2013 16:46:10 +0000
(17:46 +0100)
PLC/Methods/UpdatePerson.py
patch
|
blob
|
history
diff --git
a/PLC/Methods/UpdatePerson.py
b/PLC/Methods/UpdatePerson.py
index
b85cc64
..
1874f13
100644
(file)
--- 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.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',
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)
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
for (tagname,value) in tags.iteritems():
# the tagtype instance is assumed to exist, just check that