From 0bb980e9ec0d7a1ba224e5cd60baeeb7a3fe5636 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 21 Aug 2019 09:14:03 -0700 Subject: [PATCH] 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 --- keystone/application_credential/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/keystone/application_credential/core.py b/keystone/application_credential/core.py index 363c4af6a8..2feb13342a 100644 --- a/keystone/application_credential/core.py +++ b/keystone/application_credential/core.py @@ -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):