diff options
Diffstat (limited to 'keystone-moon/keystone/contrib/moon/backends/sql.py')
-rw-r--r-- | keystone-moon/keystone/contrib/moon/backends/sql.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/keystone-moon/keystone/contrib/moon/backends/sql.py b/keystone-moon/keystone/contrib/moon/backends/sql.py index 06071507..2b7258ea 100644 --- a/keystone-moon/keystone/contrib/moon/backends/sql.py +++ b/keystone-moon/keystone/contrib/moon/backends/sql.py @@ -292,12 +292,6 @@ class Rule(sql.ModelBase, sql.DictBase): __all_objects__ = ( - Subject, - Object, - Action, - SubjectCategory, - ObjectCategory, - ActionCategory, SubjectScope, ObjectScope, ActionScope, @@ -305,6 +299,12 @@ __all_objects__ = ( ObjectAssignment, ActionAssignment, SubMetaRule, + SubjectCategory, + ObjectCategory, + ActionCategory, + Subject, + Object, + Action, Rule, ) @@ -375,8 +375,8 @@ class IntraExtensionConnector(IntraExtensionDriver): for _object in __all_objects__: query = session.query(_object) query = query.filter_by(intra_extension_id=intra_extension_id) - _ref = query.first() - if _ref: + _refs = query.all() + for _ref in _refs: session.delete(_ref) session.flush() session.delete(ref) @@ -936,7 +936,7 @@ class IntraExtensionConnector(IntraExtensionDriver): query = query.filter_by(id=intra_extension_id) ref = query.first() try: - return ref.intra_extension["aggregation_algorithm"] + return {"aggregation_algorithm": ref.intra_extension["aggregation_algorithm"]} except KeyError: return "" @@ -948,7 +948,8 @@ class IntraExtensionConnector(IntraExtensionDriver): intra_extension_dict = dict(ref.intra_extension) intra_extension_dict["aggregation_algorithm"] = aggregation_algorithm_id setattr(ref, "intra_extension", intra_extension_dict) - return self.get_aggregation_algorithm_id(intra_extension_id) + session.flush() + return {"aggregation_algorithm": ref.intra_extension["aggregation_algorithm"]} def del_aggregation_algorithm(self, intra_extension_id): with sql.transaction() as session: |