def get_metadef_namespace_repo(self, context): ns_repo = glance.db.MetadefNamespaceRepo(context, self.db_api) policy_ns_repo = policy.MetadefNamespaceRepoProxy( ns_repo, context, self.policy) authorized_ns_repo = authorization.MetadefNamespaceRepoProxy( policy_ns_repo, context) return authorized_ns_repo
def get_metadef_namespace_repo(self, context, authorization_layer=True): """Get the layered NamespaceRepo model. This is where we construct the "the onion" by layering NamespaceRepo 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 NamespaceRepo-like object """ repo = glance.db.MetadefNamespaceRepo(context, self.db_api) if authorization_layer: repo = policy.MetadefNamespaceRepoProxy(repo, context, self.policy) repo = glance.notifier.MetadefNamespaceRepoProxy( repo, context, self.notifier) if authorization_layer: repo = authorization.MetadefNamespaceRepoProxy(repo, context) return repo