forked from p15670423/monkey
Island: Fix mongo_credentials_repository.py to use correct database
This commit is contained in:
parent
9acc249d48
commit
4b0f56d8d8
|
@ -14,14 +14,20 @@ class MongoCredentialsRepository(ICredentialsRepository):
|
|||
"""
|
||||
|
||||
def __init__(self, mongo: MongoClient, repository_encryptor: ILockableEncryptor):
|
||||
self._mongo = mongo
|
||||
self._repository_encryptor = repository_encryptor
|
||||
self._database = mongo.monkeyisland
|
||||
|
||||
|
||||
def get_configured_credentials(self) -> Sequence[Credentials]:
|
||||
return self._get_credentials_from_collection(self._mongo.db.configured_credentials)
|
||||
return MongoCredentialsRepository._get_credentials_from_collection(
|
||||
self._database.configured_credentials
|
||||
)
|
||||
|
||||
|
||||
def get_stolen_credentials(self) -> Sequence[Credentials]:
|
||||
return self._get_credentials_from_collection(self._mongo.db.stolen_credentials)
|
||||
return MongoCredentialsRepository._get_credentials_from_collection(
|
||||
self._database.stolen_credentials
|
||||
)
|
||||
|
||||
|
||||
def get_all_credentials(self) -> Sequence[Credentials]:
|
||||
configured_credentials = self.get_configured_credentials()
|
||||
|
@ -31,19 +37,25 @@ class MongoCredentialsRepository(ICredentialsRepository):
|
|||
|
||||
def save_configured_credentials(self, credentials: Sequence[Credentials]):
|
||||
# TODO: Fix deduplication of Credentials in mongo
|
||||
self._save_credentials_to_collection(credentials, self._mongo.db.configured_credentials)
|
||||
MongoCredentialsRepository._save_credentials_to_collection(
|
||||
credentials, self._database.configured_credentials
|
||||
)
|
||||
|
||||
|
||||
def save_stolen_credentials(self, credentials: Sequence[Credentials]):
|
||||
self._save_credentials_to_collection(credentials, self._mongo.db.stolen_credentials)
|
||||
MongoCredentialsRepository._save_credentials_to_collection(
|
||||
credentials, self._database.stolen_credentials
|
||||
)
|
||||
|
||||
|
||||
def remove_configured_credentials(self):
|
||||
MongoCredentialsRepository._remove_credentials_fom_collection(
|
||||
self._mongo.db.configured_credentials
|
||||
self._database.configured_credentials
|
||||
)
|
||||
|
||||
def remove_stolen_credentials(self):
|
||||
MongoCredentialsRepository._remove_credentials_fom_collection(
|
||||
self._mongo.db.stolen_credentials
|
||||
self._database.stolen_credentials
|
||||
)
|
||||
|
||||
def remove_all_credentials(self):
|
||||
|
|
Loading…
Reference in New Issue