Impelment account deactivation [revision requested] (#3571)

Impelment account deactivation
This commit is contained in:
Blake Griffith
2017-01-17 16:00:07 -08:00
committed by Brad Warren
parent 0fa307806e
commit 49d46ef99a
11 changed files with 163 additions and 10 deletions
+13
View File
@@ -3,6 +3,7 @@ import datetime
import hashlib
import logging
import os
import shutil
import socket
from cryptography.hazmat.primitives import serialization
@@ -197,6 +198,18 @@ class AccountFileStorage(interfaces.AccountStorage):
"""
self._save(account, regr_only=True)
def delete(self, account_id):
"""Delete registration info from disk
:param account_id: id of account which should be deleted
"""
account_dir_path = self._account_dir_path(account_id)
if not os.path.isdir(account_dir_path):
raise errors.AccountNotFound(
"Account at %s does not exist" % account_dir_path)
shutil.rmtree(account_dir_path)
def _save(self, account, regr_only):
account_dir_path = self._account_dir_path(account.id)
util.make_or_verify_dir(account_dir_path, 0o700, os.geteuid(),