Ejemplo n.º 1
0
 def get_metadef_property_repo(self, context):
     prop_repo = glance.db.MetadefPropertyRepo(context, self.db_api)
     policy_prop_repo = policy.MetadefPropertyRepoProxy(
         prop_repo, context, self.policy)
     authorized_prop_repo = authorization.MetadefPropertyRepoProxy(
         policy_prop_repo, context)
     return authorized_prop_repo
Ejemplo n.º 2
0
    def get_metadef_property_repo(self, context, authorization_layer=True):
        """Get the layered MetadefPropertyRepo model.

        This is where we construct the "the onion" by layering
        MetadefPropertyRepo 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 MetadefPropertyRepo-like object
        """
        repo = glance.db.MetadefPropertyRepo(context, self.db_api)
        if authorization_layer:
            repo = policy.MetadefPropertyRepoProxy(repo, context, self.policy)
        repo = glance.notifier.MetadefPropertyRepoProxy(
            repo, context, self.notifier)
        if authorization_layer:
            repo = authorization.MetadefPropertyRepoProxy(repo, context)
        return repo