"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/identity/shadow_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 55 skipping to change at line 55
if email: if email:
user['email'] = email user['email'] = email
with sql.session_for_write() as session: with sql.session_for_write() as session:
federated_ref = model.FederatedUser.from_dict(federated_dict) federated_ref = model.FederatedUser.from_dict(federated_dict)
user_ref = model.User.from_dict(user) user_ref = model.User.from_dict(user)
user_ref.created_at = datetime.datetime.utcnow() user_ref.created_at = datetime.datetime.utcnow()
user_ref.federated_users.append(federated_ref) user_ref.federated_users.append(federated_ref)
session.add(user_ref) session.add(user_ref)
return identity_base.filter_user(user_ref.to_dict()) return identity_base.filter_user(user_ref.to_dict())
@sql.handle_conflicts(conflict_type='federated_user')
def create_federated_object(self, fed_dict):
with sql.session_for_write() as session:
fed_ref = model.FederatedUser.from_dict(fed_dict)
session.add(fed_ref)
def delete_federated_object(self, user_id):
with sql.session_for_write() as session:
q = session.query(model.FederatedUser)
q = q.filter(model.FederatedUser.user_id == user_id)
q.delete(False)
def get_federated_objects(self, user_id):
with sql.session_for_read() as session:
query = session.query(model.FederatedUser)
query = query.filter(model.FederatedUser.user_id == user_id)
fed_ref = []
for row in query:
m = model.FederatedUser(
idp_id=row.idp_id,
protocol_id=row.protocol_id,
unique_id=row.unique_id)
fed_ref.append(m.to_dict())
return base.federated_objects_to_list(fed_ref)
def _update_query_with_federated_statements(self, hints, query): def _update_query_with_federated_statements(self, hints, query):
statements = [] statements = []
for filter_ in hints.filters: for filter_ in hints.filters:
if filter_['name'] == 'idp_id': if filter_['name'] == 'idp_id':
statements.append( statements.append(
model.FederatedUser.idp_id == filter_['value']) model.FederatedUser.idp_id == filter_['value'])
if filter_['name'] == 'protocol_id': if filter_['name'] == 'protocol_id':
statements.append( statements.append(
model.FederatedUser.protocol_id == filter_['value']) model.FederatedUser.protocol_id == filter_['value'])
if filter_['name'] == 'unique_id': if filter_['name'] == 'unique_id':
skipping to change at line 196 skipping to change at line 221
if not user_ref: if not user_ref:
raise exception.UserNotFound(user_id=user_id) raise exception.UserNotFound(user_id=user_id)
return user_ref return user_ref
def list_federated_users_info(self, hints=None): def list_federated_users_info(self, hints=None):
with sql.session_for_read() as session: with sql.session_for_read() as session:
query = session.query(model.FederatedUser) query = session.query(model.FederatedUser)
fed_user_refs = sql.filter_limit_query(model.FederatedUser, query, fed_user_refs = sql.filter_limit_query(model.FederatedUser, query,
hints) hints)
return [x.to_dict() for x in fed_user_refs] return [x.to_dict() for x in fed_user_refs]
def add_user_to_group_expires(self, user_id, group_id):
def get_federated_user():
with sql.session_for_read() as session:
query = session.query(model.FederatedUser)
query = query.filter_by(user_id=user_id)
user = query.first()
if not user:
# Note(knikolla): This shouldn't really ever happen, since
# this requires the user to already be logged in.
raise exception.UserNotFound()
return user
with sql.session_for_write() as session:
user = get_federated_user()
query = session.query(model.ExpiringUserGroupMembership)
query = query.filter_by(user_id=user_id)
query = query.filter_by(group_id=group_id)
membership = query.first()
if membership:
membership.last_verified = datetime.datetime.utcnow()
else:
session.add(model.ExpiringUserGroupMembership(
user_id=user_id,
group_id=group_id,
idp_id=user.idp_id,
last_verified=datetime.datetime.utcnow()
))
 End of changes. 2 change blocks. 
0 lines changed or deleted 25 lines changed or added

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