From e0dc7b48e9c705415e949ca01320758e2df1703d Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 6 Feb 2012 20:33:57 +0530 Subject: [PATCH] check for canEditFeaturedLists permission editing lists, fixes #377 --- pandora/item/models.py | 4 ++++ pandora/itemlist/models.py | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index 6133a9763..5bc60557b 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -1041,6 +1041,10 @@ class Item(models.Model): if streams.count() > 1: timelines = [s.timeline_prefix for s in self.streams()] join_timelines(timelines, self.timeline_prefix) + else: + #remove joined timeline if it was created at some point + for f in glob(os.path.join(settings.MEDIA_ROOT, self.path(), 'timeline*.png')): + os.unlink(f) def make_poster(self, force=False): ox.makedirs(os.path.join(settings.MEDIA_ROOT,self.path())) diff --git a/pandora/itemlist/models.py b/pandora/itemlist/models.py index 837efce0f..3c8d950e1 100644 --- a/pandora/itemlist/models.py +++ b/pandora/itemlist/models.py @@ -91,8 +91,11 @@ class List(models.Model): return self.user == user or self.status in ('public', 'featured') def editable(self, user): - #FIXME: make permissions work - if self.user == user or user.is_staff: + if user.is_anonymous(): + return False + if self.user == user or \ + user.is_staff or \ + user.get_profile().capability('canEditFeaturedLists') == True: return True return False