existing_records = table.find({'type': type, 'hrn': hrn})
if existing_records:
raise ExistingRecord(hrn)
existing_records = table.find({'type': type, 'hrn': hrn})
if existing_records:
raise ExistingRecord(hrn)
persons = self.api.plshell.GetPersons(self.api.plauth, [record['email']])
if not persons:
pointer = self.api.plshell.AddPerson(self.api.plauth, dict(record))
persons = self.api.plshell.GetPersons(self.api.plauth, [record['email']])
if not persons:
pointer = self.api.plshell.AddPerson(self.api.plauth, dict(record))
if 'enabled' in record and record['enabled']:
self.api.plshell.UpdatePerson(self.api.plauth, pointer, {'enabled': record['enabled']})
if 'enabled' in record and record['enabled']:
self.api.plshell.UpdatePerson(self.api.plauth, pointer, {'enabled': record['enabled']})
# add this persons to the site only if he is being added for the first
# time by sfa and doesont already exist in plc
if not persons or not persons[0]['site_ids']:
login_base = get_leaf(auth_name)
self.api.plshell.AddPersonToSite(self.api.plauth, pointer, login_base)
# add this persons to the site only if he is being added for the first
# time by sfa and doesont already exist in plc
if not persons or not persons[0]['site_ids']:
login_base = get_leaf(auth_name)
self.api.plshell.AddPersonToSite(self.api.plauth, pointer, login_base)
# What roles should this user have?
self.api.plshell.AddRoleToPerson(self.api.plauth, 'user', pointer)
record.set_pointer(pointer)
# What roles should this user have?
self.api.plshell.AddRoleToPerson(self.api.plauth, 'user', pointer)
record.set_pointer(pointer)
# Add the user's key
if pub_key:
self.api.plshell.AddPersonKey(self.api.plauth, pointer, {'key_type' : 'ssh', 'key' : pub_key})
# Add the user's key
if pub_key:
self.api.plshell.AddPersonKey(self.api.plauth, pointer, {'key_type' : 'ssh', 'key' : pub_key})
- # SFA upcalls may exist in PLCAPI and they could have already added the
- # record for us. Lets check if the record already exists
- existing_records = table.find({'type': type, 'hrn': hrn})
- if not existing_records:
- table.insert(record)
# update membership for researchers, pis, owners, operators
self.api.update_membership(None, record)
# update membership for researchers, pis, owners, operators
self.api.update_membership(None, record)