totals admin: true -> capability, fixes #2504

This commit is contained in:
j 2014-10-02 20:08:38 +02:00
parent dd2fca85a4
commit 991ef93876
5 changed files with 13 additions and 14 deletions

View file

@ -749,9 +749,9 @@
"totals": [
{"id": "items"},
{"id": "runtime"},
{"id": "files", "admin": true},
{"id": "duration", "admin": true},
{"id": "size", "admin": true},
{"id": "files", "capability": "canSeeMedia"},
{"id": "duration", "capability": "canSeeMedia"},
{"id": "size", "capability": "canSeeMedia"},
{"id": "pixels"}
],
"tv": {

View file

@ -762,9 +762,9 @@
"totals": [
{"id": "items"},
{"id": "runtime"},
{"id": "files", "admin": true},
{"id": "duration", "admin": true},
{"id": "size", "admin": true},
{"id": "files", "capability": "canSeeMedia"},
{"id": "duration", "capability": "canSeeMedia"},
{"id": "size", "capability": "canSeeMedia"},
{"id": "pixels"}
],
"tv": {

View file

@ -644,9 +644,9 @@
],
"totals": [
{"id": "items"},
{"id": "files", "admin": true},
{"id": "duration", "admin": true},
{"id": "size", "admin": true},
{"id": "files", "capability": "canSeeMedia"},
{"id": "duration", "capability": "canSeeMedia"},
{"id": "size", "capability": "canSeeMedia"},
{"id": "pixels"}
],
"tv": {

View file

@ -560,9 +560,9 @@
],
"totals": [
{"id": "items"},
{"id": "files", "admin": true},
{"id": "duration", "admin": true},
{"id": "size", "admin": true},
{"id": "files", "capability": "canSeeMedia"},
{"id": "duration", "capability": "canSeeMedia"},
{"id": "size", "capability": "canSeeMedia"},
{"id": "pixels"}
],
"tv": {

View file

@ -282,10 +282,9 @@ Positions
Sum('pixels'),
Sum('size')
)
level = 'guest' if request.user.is_anonymous() else request.user.get_profile().get_level()
totals = [i['id']
for i in settings.CONFIG['totals']
if not i.get('admin', False) or level in ('admin', 'staff')
if not 'capability' in i or has_capability(request.user, i['capability'])
]
if 'duration' in totals:
response['data']['duration'] = r['duration__sum']