[Fixture] 添加用户profile

This commit is contained in:
ibuler
2017-03-30 00:51:36 +08:00
parent 4e7b665ea8
commit 0983f294b7
9 changed files with 227 additions and 59 deletions

View File

@@ -100,6 +100,16 @@ class User(AbstractUser):
def public_key(self, public_key_raw):
self._public_key = signer.sign(public_key_raw)
@property
def public_key_hash(self):
if self.public_key:
import sshpubkeys
try:
return sshpubkeys.SSHKey(self.public_key).hash_md5()
except TabError:
pass
return 'None'
@property
def is_superuser(self):
if self.role == 'Admin':