示例#1
0
 def get_metadef_resource_type_repo(self, context):
     resource_type_repo = glance.db.MetadefResourceTypeRepo(
         context, self.db_api)
     policy_object_repo = policy.MetadefResourceTypeRepoProxy(
         resource_type_repo, context, self.policy)
     return authorization.MetadefResourceTypeRepoProxy(policy_object_repo,
                                                       context)
示例#2
0
文件: gateway.py 项目: crowdy/glance
    def get_metadef_resource_type_repo(self,
                                       context,
                                       authorization_layer=True):
        """Get the layered MetadefResourceTypeRepo model.

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