forked from 0x2620/pandora
set rightslevel based on user
This commit is contained in:
parent
37a32f1abb
commit
3b1c1f87cc
2 changed files with 7 additions and 3 deletions
|
@ -257,9 +257,9 @@ def moveFiles(request):
|
||||||
data['director'] = []
|
data['director'] = []
|
||||||
else:
|
else:
|
||||||
data['director'] = data['director'].split(', ')
|
data['director'] = data['director'].split(', ')
|
||||||
i = get_item(data)
|
i = get_item(data, user=request.user)
|
||||||
else:
|
else:
|
||||||
i = get_item({'imdbId': data['itemId']})
|
i = get_item({'imdbId': data['itemId']}, user=request.user)
|
||||||
changed = [i.itemId]
|
changed = [i.itemId]
|
||||||
for f in models.File.objects.filter(oshash__in=data['ids']):
|
for f in models.File.objects.filter(oshash__in=data['ids']):
|
||||||
if f.item.id != i.itemId and f.editable(request.user):
|
if f.item.id != i.itemId and f.editable(request.user):
|
||||||
|
|
|
@ -253,6 +253,8 @@ class Item(models.Model):
|
||||||
update_poster = False
|
update_poster = False
|
||||||
update_ids = False
|
update_ids = False
|
||||||
if not self.id:
|
if not self.id:
|
||||||
|
if self.user:
|
||||||
|
self.level = settings.CONFIG['rightsLevel'][self.user.get_profile().get_level()]
|
||||||
if not self.itemId:
|
if not self.itemId:
|
||||||
self.itemId = str(uuid.uuid1())
|
self.itemId = str(uuid.uuid1())
|
||||||
super(Item, self).save(*args, **kwargs)
|
super(Item, self).save(*args, **kwargs)
|
||||||
|
@ -943,7 +945,9 @@ class Item(models.Model):
|
||||||
self.save()
|
self.save()
|
||||||
elif os.path.exists(poster):
|
elif os.path.exists(poster):
|
||||||
with open(poster) as f:
|
with open(poster) as f:
|
||||||
self.poster.save('poster.jpg', ContentFile(f.read()))
|
data = f.read()
|
||||||
|
if data:
|
||||||
|
self.poster.save('poster.jpg', ContentFile(data))
|
||||||
|
|
||||||
def make_siteposter(self):
|
def make_siteposter(self):
|
||||||
poster = self.path('siteposter.jpg')
|
poster = self.path('siteposter.jpg')
|
||||||
|
|
Loading…
Reference in a new issue