def test_remove_access(self):
        project_id = "456"
        extra_specs = {constants.ExtraSpecs.DRIVER_HANDLES_SHARE_SERVERS: "true"}
        share_type = share_types.create(self.context, "type1", projects=["456"], extra_specs=extra_specs)
        share_type_id = share_type.get("id")

        share_types.remove_share_type_access(self.context, share_type_id, project_id)
        stype_access = db.share_type_access_get_all(self.context, share_type_id)
        self.assertNotIn(project_id, stype_access)
Example #2
0
    def _remove_project_access(self, req, id, body):
        context = req.environ['manila.context']
        self._check_body(body, 'removeProjectAccess')
        project = body['removeProjectAccess']['project']

        self._verify_if_non_public_share_type(context, id)

        try:
            share_types.remove_share_type_access(context, id, project)
        except exception.ShareTypeAccessNotFound as err:
            raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
        return webob.Response(status_int=202)
Example #3
0
    def _remove_project_access(self, req, id, body):
        context = req.environ['manila.context']
        self._check_body(body, 'removeProjectAccess')
        project = body['removeProjectAccess']['project']

        self._verify_if_non_public_share_type(context, id)

        try:
            share_types.remove_share_type_access(context, id, project)
        except exception.ShareTypeAccessNotFound as err:
            raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
        return webob.Response(status_int=http_client.ACCEPTED)
Example #4
0
    def _removeProjectAccess(self, req, id, body):
        context = req.environ['manila.context']
        authorize(context, action="removeProjectAccess")
        self._check_body(body, 'removeProjectAccess')
        project = body['removeProjectAccess']['project']

        try:
            share_types.remove_share_type_access(context, id, project)
        except (exception.ShareTypeNotFound,
                exception.ShareTypeAccessNotFound) as err:
            raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
        return webob.Response(status_int=202)
Example #5
0
    def test_remove_access(self):
        project_id = '456'
        extra_specs = {
            constants.ExtraSpecs.DRIVER_HANDLES_SHARE_SERVERS: 'true'
        }
        share_type = share_types.create(
            self.context, 'type1', projects=['456'], extra_specs=extra_specs)
        share_type_id = share_type.get('id')

        share_types.remove_share_type_access(self.context, share_type_id,
                                             project_id)
        stype_access = db.share_type_access_get_all(self.context,
                                                    share_type_id)
        self.assertNotIn(project_id, stype_access)