Merge "Minor cleanup from patch 429047"

This commit is contained in:
Jenkins 2017-03-05 05:59:18 +00:00 committed by Gerrit Code Review
commit 898c921fab
4 changed files with 16 additions and 19 deletions

View File

@ -223,7 +223,7 @@ class IdentityDriverBase(object):
@abc.abstractmethod @abc.abstractmethod
def unset_default_project_id(self, project_id): def unset_default_project_id(self, project_id):
"""Unset a users default project given a specific project ID. """Unset a user's default project given a specific project ID.
:param str project_id: project ID :param str project_id: project ID

View File

@ -88,8 +88,8 @@ class Identity(base.IdentityDriverBase):
return self.user.get_all_filtered(hints) return self.user.get_all_filtered(hints)
def unset_default_project_id(self, project_id): def unset_default_project_id(self, project_id):
# This function is not implemented for the LDAP backend # This function is not implemented for the LDAP backend. The LDAP
# LDAP backend is readonly. # backend is readonly.
self._disallow_write() self._disallow_write()
def get_user_by_name(self, user_name, domain_id): def get_user_by_name(self, user_name, domain_id):

View File

@ -491,7 +491,7 @@ class Manager(manager.Manager):
self.event_callbacks = { self.event_callbacks = {
notifications.ACTIONS.deleted: { notifications.ACTIONS.deleted: {
'domain': [self._domain_deleted], 'domain': [self._domain_deleted],
'project': [self._set_default_project_to_none], 'project': [self._unset_default_project],
}, },
} }
@ -522,15 +522,13 @@ class Manager(manager.Manager):
'cleanup.'), 'cleanup.'),
{'userid': user['id'], 'domainid': domain_id}) {'userid': user['id'], 'domainid': domain_id})
def _set_default_project_to_none(self, service, resource_type, operation, def _unset_default_project(self, service, resource_type, operation,
payload): payload):
"""Callback, clears user default_project_id after project deletion. """Callback, clears user default_project_id after project deletion.
Notification approach was used instead of using a FK constraint. Notifications are used to unset a user's default project because
Reason being, operators are allowed to have separate backends for there is no foreign key to the project. Projects can be in a non-SQL
various keystone subsystems. This doesn't guarantee that projects and backend, making FKs impossible.
users will be stored in the same backend, meaning we can't rely on FK
constraints to do this work for us.
""" """
project_id = payload['resource_info'] project_id = payload['resource_info']

View File

@ -1,14 +1,13 @@
fixes: fixes:
- | - |
[`bug 1523369 <https://bugs.launchpad.net/keystone/+bug/1523369>`_] [`bug 1523369 <https://bugs.launchpad.net/keystone/+bug/1523369>`_]
Currently, if a project is deleted, it is not removed as a user's default Deleting a project will now cause it to be removed as a default project
project id. Now the default project id is set to none, however changes may for users. If caching is enabled the changes may not be visible until the
not be visible until memcache end of life. user's cache entry expires.
upgrade: upgrade:
- | - |
The identity backend driver interface has changed. We've added a new The identity backend driver interface has changed. A new method,
``unset_default_project_id(project_id)`` method to unset a users default ``unset_default_project_id(project_id)``, was added to unset a user's
project id matching the given project id. If you have a custom default project ID for a given project ID. Custom backend implementations
implementation for the identity driver, you will need to implement this must implement this method.
new method.