Add notifications for deleting app creds by user

Without this patch, when an individual application credential is deleted
it emits a notification, but when all are deleted for a user there is no
notification (although this is only triggered when a user is deleted or
disabled or has a change in role assignments, all of which generate
their own notifications). This patch ensures audit notifications are
generated for every application credential that gets deleted.

Change-Id: I7c820931585802c7afa53727623ac05adee56248
This commit is contained in:
Colleen Murphy 2019-08-21 09:14:03 -07:00
parent 83de31f3cf
commit 0bb980e9ec
1 changed files with 4 additions and 1 deletions

View File

@ -183,7 +183,8 @@ class Manager(manager.Manager):
notifications.Audit.deleted(
self._APP_CRED, application_credential_id, initiator)
def _delete_application_credentials_for_user(self, user_id):
def _delete_application_credentials_for_user(self, user_id,
initiator=None):
"""Delete all application credentials for a user.
:param str user_id: User ID
@ -195,6 +196,8 @@ class Manager(manager.Manager):
self.driver.delete_application_credentials_for_user(user_id)
for app_cred in app_creds:
self.get_application_credential.invalidate(self, app_cred['id'])
notifications.Audit.deleted(self._APP_CRED, app_cred['id'],
initiator)
def _delete_application_credentials_for_user_on_project(self, user_id,
project_id):