Skip to content

Commit

Permalink
Ensure image owned by user before delayed_deletion
Browse files Browse the repository at this point in the history
Fixes bug 1065187.

Change-Id: Icf2f117a094c712bad645ef5f297e9f7da994c84
  • Loading branch information
bcwaldon committed Nov 8, 2012
1 parent e6be061 commit efd7e75
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions glance/api/v1/images.py
Expand Up @@ -727,6 +727,15 @@ def delete(self, req, id):
content_type="text/plain")

image = self.get_image_meta_or_404(req, id)

if not (req.context.is_admin
or image['owner'] == None
or image['owner'] == req.context.owner):
msg = _("Unable to delete image you do not own")
logger.debug(msg)
raise HTTPForbidden(msg, request=req,
content_type="text/plain")

if image['protected']:
msg = _("Image is protected")
logger.debug(msg)
Expand Down

0 comments on commit efd7e75

Please sign in to comment.