Ejemplo n.º 1
0
    def test_remove_access(self):
        project_id = '456'
        vtype = volume_types.create(self.ctxt, 'type1', projects=['456'])
        vtype_id = vtype.get('id')

        volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id)
        vtype_access = db.volume_type_access_get_all(self.ctxt, vtype_id)
        self.assertNotIn(project_id, vtype_access)
Ejemplo n.º 2
0
    def test_remove_access(self):
        project_id = '456'
        vtype = volume_types.create(self.ctxt, 'type1', projects=['456'])
        vtype_id = vtype.get('id')

        volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id)
        vtype_access = db.volume_type_access_get_all(self.ctxt, vtype_id)
        self.assertNotIn(project_id, vtype_access)
Ejemplo n.º 3
0
    def _removeProjectAccess(self, req, id, body):
        context = req.environ['cinder.context']
        context.authorize(policy.REMOVE_PROJECT_POLICY)
        project = body['removeProjectAccess']['project']

        # Not found exception will be handled at the wsgi level
        volume_types.remove_volume_type_access(context, id, project)
        return webob.Response(status_int=http_client.ACCEPTED)
Ejemplo n.º 4
0
    def _removeProjectAccess(self, req, id, body):
        context = req.environ['cinder.context']
        context.authorize(policy.REMOVE_PROJECT_POLICY)
        project = body['removeProjectAccess']['project']

        # Not found exception will be handled at the wsgi level
        volume_types.remove_volume_type_access(context, id, project)
        return webob.Response(status_int=http_client.ACCEPTED)
Ejemplo n.º 5
0
    def test_remove_access(self):
        project_id = "456"
        vtype = volume_types.create(self.ctxt, "type1", projects=["456"], is_public=False)
        vtype_id = vtype.get("id")

        volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id)
        vtype_access = db.volume_type_access_get_all(self.ctxt, vtype_id)
        self.assertNotIn(project_id, vtype_access)
Ejemplo n.º 6
0
    def test_remove_access(self):
        project_id = fake.PROJECT_ID
        vtype = volume_types.create(self.ctxt, 'type1', projects=[project_id],
                                    is_public=False)
        vtype_id = vtype.get('id')

        volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id)
        vtype_access = db.volume_type_access_get_all(self.ctxt, vtype_id)
        self.assertNotIn(project_id, vtype_access)
Ejemplo n.º 7
0
    def _removeProjectAccess(self, req, id, body):
        context = req.environ['cinder.context']
        authorize(context, action="removeProjectAccess")
        self._check_body(body, 'removeProjectAccess')
        project = body['removeProjectAccess']['project']

        # Not found exception will be handled at the wsgi level
        volume_types.remove_volume_type_access(context, id, project)
        return webob.Response(status_int=http_client.ACCEPTED)
Ejemplo n.º 8
0
    def test_remove_access(self):
        project_id = fake.PROJECT_ID
        vtype = volume_types.create(self.ctxt, 'type1', projects=[project_id],
                                    is_public=False)
        vtype_id = vtype.get('id')

        volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id)
        vtype_access = db.volume_type_access_get_all(self.ctxt, vtype_id)
        self.assertNotIn(project_id, vtype_access)
Ejemplo n.º 9
0
    def test_remove_access_with_non_admin(self):
        self.ctxt = context.RequestContext("fake", "fake", is_admin=False)
        project_id = fake.PROJECT_ID
        vtype = volume_types.create(self.ctxt, "type1", projects=[project_id], is_public=False)
        vtype_id = vtype.get("id")

        volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id)
        vtype_access = db.volume_type_access_get_all(self.ctxt.elevated(), vtype_id)
        self.assertNotIn(project_id, vtype_access)
Ejemplo n.º 10
0
    def _removeProjectAccess(self, req, id, body):
        context = req.environ['cinder.context']
        authorize(context, action="removeProjectAccess")
        self._check_body(body, 'removeProjectAccess')
        project = body['removeProjectAccess']['project']

        # Not found exception will be handled at the wsgi level
        volume_types.remove_volume_type_access(context, id, project)
        return webob.Response(status_int=202)
Ejemplo n.º 11
0
    def test_remove_access_with_non_admin(self):
        self.ctxt = context.RequestContext('fake', 'fake', is_admin=False)
        project_id = fake.PROJECT_ID
        vtype = volume_types.create(self.ctxt, 'type1', projects=[project_id],
                                    is_public=False)
        vtype_id = vtype.get('id')

        volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id)
        vtype_access = db.volume_type_access_get_all(self.ctxt.elevated(),
                                                     vtype_id)
        self.assertNotIn(project_id, vtype_access)
Ejemplo n.º 12
0
    def _removeProjectAccess(self, req, id, body):
        context = req.environ["cinder.context"]
        authorize(context, action="removeProjectAccess")
        self._check_body(body, "removeProjectAccess")
        project = body["removeProjectAccess"]["project"]

        try:
            volume_types.remove_volume_type_access(context, id, project)
        except (exception.VolumeTypeNotFound, exception.VolumeTypeAccessNotFound) as err:
            raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
        return webob.Response(status_int=202)
Ejemplo n.º 13
0
    def test_remove_access_with_non_admin(self):
        self.ctxt = context.RequestContext('fake', 'fake', is_admin=False)
        project_id = '456'
        vtype = volume_types.create(self.ctxt, 'type1', projects=['456'],
                                    is_public=False)
        vtype_id = vtype.get('id')

        volume_types.remove_volume_type_access(self.ctxt, vtype_id, project_id)
        vtype_access = db.volume_type_access_get_all(self.ctxt.elevated(),
                                                     vtype_id)
        self.assertNotIn(project_id, vtype_access)
Ejemplo n.º 14
0
    def _removeProjectAccess(self, req, id, body):
        context = req.environ['cinder.context']
        authorize(context, action="removeProjectAccess")
        self._check_body(body, 'removeProjectAccess')
        project = body['removeProjectAccess']['project']

        try:
            volume_types.remove_volume_type_access(context, id, project)
        except (exception.VolumeTypeNotFound,
                exception.VolumeTypeAccessNotFound) as err:
            raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
        return webob.Response(status_int=202)