示例#1
0
 def get_metadef_tag_repo(self, context):
     tag_repo = glance.db.MetadefTagRepo(context, self.db_api)
     policy_tag_repo = policy.MetadefTagRepoProxy(
         tag_repo, context, self.policy)
     authorized_tag_repo = authorization.MetadefTagRepoProxy(
         policy_tag_repo, context)
     return authorized_tag_repo
示例#2
0
文件: gateway.py 项目: crowdy/glance
    def get_metadef_tag_repo(self, context, authorization_layer=True):
        """Get the layered MetadefTagRepo model.

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