check for canEditFeaturedLists permission editing lists, fixes #377

This commit is contained in:
j 2012-02-06 20:33:57 +05:30
parent 525fab0400
commit e0dc7b48e9
2 changed files with 9 additions and 2 deletions

View file

@ -1041,6 +1041,10 @@ class Item(models.Model):
if streams.count() > 1: if streams.count() > 1:
timelines = [s.timeline_prefix for s in self.streams()] timelines = [s.timeline_prefix for s in self.streams()]
join_timelines(timelines, self.timeline_prefix) 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): def make_poster(self, force=False):
ox.makedirs(os.path.join(settings.MEDIA_ROOT,self.path())) ox.makedirs(os.path.join(settings.MEDIA_ROOT,self.path()))

View file

@ -91,8 +91,11 @@ class List(models.Model):
return self.user == user or self.status in ('public', 'featured') return self.user == user or self.status in ('public', 'featured')
def editable(self, user): def editable(self, user):
#FIXME: make permissions work if user.is_anonymous():
if self.user == user or user.is_staff: return False
if self.user == user or \
user.is_staff or \
user.get_profile().capability('canEditFeaturedLists') == True:
return True return True
return False return False