    def delete(self, req, image_id):
        self._enforce(req, 'delete_image')
        image = self._get_image(req.context, image_id)

        if image['protected']:
            msg = _("Unable to delete as image %(image_id)s is protected"
                    % locals())
            raise webob.exc.HTTPForbidden(explanation=msg)

        if image['location'] and CONF.delayed_delete:
            status = 'pending_delete'
        else:
            status = 'deleted'

        try:
            self.db_api.image_update(req.context, image_id, {'status': status})
            self.db_api.image_destroy(req.context, image_id)

            if image['location']:
                if CONF.delayed_delete:
                    self.store_api.schedule_delayed_delete_from_backend(
                                    image['location'], id)
                else:
                    self.store_api.safe_delete_from_backend(image['location'],
                                                            req.context, id)
        except (exception.NotFound, exception.Forbidden):
            msg = ("Failed to find image %(image_id)s to delete" % locals())
            LOG.info(msg)
            raise webob.exc.HTTPNotFound()
        else:
            self.notifier.info('image.delete', image)
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.