"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/federation/backends/sql.py" between
keystone-16.0.1.tar.gz and keystone-17.0.0.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Ussuri" series (latest release).

sql.py  (keystone-16.0.1):sql.py  (keystone-17.0.0)
skipping to change at line 17 skipping to change at line 17
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo_log import log from oslo_log import log
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import six
from sqlalchemy import orm from sqlalchemy import orm
from keystone.common import sql from keystone.common import sql
from keystone import exception from keystone import exception
from keystone.federation.backends import base from keystone.federation.backends import base
from keystone.i18n import _ from keystone.i18n import _
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
class FederationProtocolModel(sql.ModelBase, sql.ModelDictMixin): class FederationProtocolModel(sql.ModelBase, sql.ModelDictMixin):
skipping to change at line 52 skipping to change at line 51
def to_dict(self): def to_dict(self):
"""Return a dictionary with model's attributes.""" """Return a dictionary with model's attributes."""
d = dict() d = dict()
for attr in self.__class__.attributes: for attr in self.__class__.attributes:
d[attr] = getattr(self, attr) d[attr] = getattr(self, attr)
return d return d
class IdentityProviderModel(sql.ModelBase, sql.ModelDictMixin): class IdentityProviderModel(sql.ModelBase, sql.ModelDictMixin):
__tablename__ = 'identity_provider' __tablename__ = 'identity_provider'
attributes = ['id', 'domain_id', 'enabled', 'description', 'remote_ids'] attributes = ['id', 'domain_id', 'enabled', 'description', 'remote_ids',
mutable_attributes = frozenset(['description', 'enabled', 'remote_ids']) 'authorization_ttl']
mutable_attributes = frozenset(['description', 'enabled', 'remote_ids',
'authorization_ttl'])
id = sql.Column(sql.String(64), primary_key=True) id = sql.Column(sql.String(64), primary_key=True)
domain_id = sql.Column(sql.String(64), sql.ForeignKey('project.id'), domain_id = sql.Column(sql.String(64), nullable=False)
nullable=False)
enabled = sql.Column(sql.Boolean, nullable=False) enabled = sql.Column(sql.Boolean, nullable=False)
description = sql.Column(sql.Text(), nullable=True) description = sql.Column(sql.Text(), nullable=True)
authorization_ttl = sql.Column(sql.Integer, nullable=True)
remote_ids = orm.relationship('IdPRemoteIdsModel', remote_ids = orm.relationship('IdPRemoteIdsModel',
order_by='IdPRemoteIdsModel.remote_id', order_by='IdPRemoteIdsModel.remote_id',
cascade='all, delete-orphan') cascade='all, delete-orphan')
expiring_user_group_memberships = orm.relationship(
'ExpiringUserGroupMembership',
cascade='all, delete-orphan',
backref="idp"
)
@classmethod @classmethod
def from_dict(cls, dictionary): def from_dict(cls, dictionary):
new_dictionary = dictionary.copy() new_dictionary = dictionary.copy()
remote_ids_list = new_dictionary.pop('remote_ids', None) remote_ids_list = new_dictionary.pop('remote_ids', None)
if not remote_ids_list: if not remote_ids_list:
remote_ids_list = [] remote_ids_list = []
identity_provider = cls(**new_dictionary) identity_provider = cls(**new_dictionary)
remote_ids = [] remote_ids = []
# NOTE(fmarco76): the remote_ids_list contains only remote ids # NOTE(fmarco76): the remote_ids_list contains only remote ids
skipping to change at line 166 skipping to change at line 173
for attr in self.__class__.attributes: for attr in self.__class__.attributes:
d[attr] = getattr(self, attr) d[attr] = getattr(self, attr)
return d return d
class Federation(base.FederationDriverBase): class Federation(base.FederationDriverBase):
_CONFLICT_LOG_MSG = 'Conflict %(conflict_type)s: %(details)s' _CONFLICT_LOG_MSG = 'Conflict %(conflict_type)s: %(details)s'
def _handle_idp_conflict(self, e): def _handle_idp_conflict(self, e):
conflict_type = 'identity_provider' conflict_type = 'identity_provider'
details = six.text_type(e) details = str(e)
LOG.debug(self._CONFLICT_LOG_MSG, {'conflict_type': conflict_type, LOG.debug(self._CONFLICT_LOG_MSG, {'conflict_type': conflict_type,
'details': details}) 'details': details})
if 'remote_id' in details: if 'remote_id' in details:
msg = _('Duplicate remote ID: %s') msg = _('Duplicate remote ID: %s')
else: else:
msg = _('Duplicate entry: %s') msg = _('Duplicate entry: %s')
msg = msg % e.value msg = msg % e.value
raise exception.Conflict(type=conflict_type, details=msg) raise exception.Conflict(type=conflict_type, details=msg)
# Identity Provider CRUD # Identity Provider CRUD
 End of changes. 6 change blocks. 
6 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)