Commit ecb9dd85 authored by Lukas Burgey's avatar Lukas Burgey

Integrate ssh keys from unity into the users keylist

parent e56d2a38
......@@ -430,6 +430,29 @@ class User(AbstractUser):
for group in query.all():
self.groups.add(group)
# include the ssh key from unity
unity_key = userinfo.get('ssh_key', '')
unity_key_name = 'unity_key'
query = self._ssh_keys.filter(name=unity_key_name)
if query.exists():
key = query.first()
if key.key != unity_key:
key.delete_key()
key = SSHPublicKey(
name=unity_key_name,
key=unity_key,
user=self,
)
key.save()
else:
key = SSHPublicKey(
name=unity_key_name,
key=unity_key,
user=self,
)
key.save()
class Site(models.Model):
client = models.OneToOneField(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment