def get_metadef_object_repo(self, context): object_repo = glance.db.MetadefObjectRepo(context, self.db_api) policy_object_repo = policy.MetadefObjectRepoProxy( object_repo, context, self.policy) authorized_object_repo = authorization.MetadefObjectRepoProxy( policy_object_repo, context) return authorized_object_repo
def get_metadef_object_repo(self, context, authorization_layer=True): """Get the layered MetadefObjectRepo model. This is where we construct the "the onion" by layering MetadefObjectRepo models on top of each other, starting with the DB at the bottom. :param context: The RequestContext :param authorization_layer: Controls whether or not we add the legacy glance.authorization and glance.policy layers. :returns: An MetadefObjectRepo-like object """ repo = glance.db.MetadefObjectRepo(context, self.db_api) if authorization_layer: repo = policy.MetadefObjectRepoProxy(repo, context, self.policy) repo = glance.notifier.MetadefObjectRepoProxy(repo, context, self.notifier) if authorization_layer: repo = authorization.MetadefObjectRepoProxy(repo, context) return repo