totals admin: true -> capability, fixes #2504
This commit is contained in:
parent
dd2fca85a4
commit
991ef93876
5 changed files with 13 additions and 14 deletions
|
@ -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": {
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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']
|
||||
|
|
Loading…
Reference in a new issue