forked from 0x2620/pandora
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": [
|
"totals": [
|
||||||
{"id": "items"},
|
{"id": "items"},
|
||||||
{"id": "runtime"},
|
{"id": "runtime"},
|
||||||
{"id": "files", "admin": true},
|
{"id": "files", "capability": "canSeeMedia"},
|
||||||
{"id": "duration", "admin": true},
|
{"id": "duration", "capability": "canSeeMedia"},
|
||||||
{"id": "size", "admin": true},
|
{"id": "size", "capability": "canSeeMedia"},
|
||||||
{"id": "pixels"}
|
{"id": "pixels"}
|
||||||
],
|
],
|
||||||
"tv": {
|
"tv": {
|
||||||
|
|
|
@ -762,9 +762,9 @@
|
||||||
"totals": [
|
"totals": [
|
||||||
{"id": "items"},
|
{"id": "items"},
|
||||||
{"id": "runtime"},
|
{"id": "runtime"},
|
||||||
{"id": "files", "admin": true},
|
{"id": "files", "capability": "canSeeMedia"},
|
||||||
{"id": "duration", "admin": true},
|
{"id": "duration", "capability": "canSeeMedia"},
|
||||||
{"id": "size", "admin": true},
|
{"id": "size", "capability": "canSeeMedia"},
|
||||||
{"id": "pixels"}
|
{"id": "pixels"}
|
||||||
],
|
],
|
||||||
"tv": {
|
"tv": {
|
||||||
|
|
|
@ -644,9 +644,9 @@
|
||||||
],
|
],
|
||||||
"totals": [
|
"totals": [
|
||||||
{"id": "items"},
|
{"id": "items"},
|
||||||
{"id": "files", "admin": true},
|
{"id": "files", "capability": "canSeeMedia"},
|
||||||
{"id": "duration", "admin": true},
|
{"id": "duration", "capability": "canSeeMedia"},
|
||||||
{"id": "size", "admin": true},
|
{"id": "size", "capability": "canSeeMedia"},
|
||||||
{"id": "pixels"}
|
{"id": "pixels"}
|
||||||
],
|
],
|
||||||
"tv": {
|
"tv": {
|
||||||
|
|
|
@ -560,9 +560,9 @@
|
||||||
],
|
],
|
||||||
"totals": [
|
"totals": [
|
||||||
{"id": "items"},
|
{"id": "items"},
|
||||||
{"id": "files", "admin": true},
|
{"id": "files", "capability": "canSeeMedia"},
|
||||||
{"id": "duration", "admin": true},
|
{"id": "duration", "capability": "canSeeMedia"},
|
||||||
{"id": "size", "admin": true},
|
{"id": "size", "capability": "canSeeMedia"},
|
||||||
{"id": "pixels"}
|
{"id": "pixels"}
|
||||||
],
|
],
|
||||||
"tv": {
|
"tv": {
|
||||||
|
|
|
@ -282,10 +282,9 @@ Positions
|
||||||
Sum('pixels'),
|
Sum('pixels'),
|
||||||
Sum('size')
|
Sum('size')
|
||||||
)
|
)
|
||||||
level = 'guest' if request.user.is_anonymous() else request.user.get_profile().get_level()
|
|
||||||
totals = [i['id']
|
totals = [i['id']
|
||||||
for i in settings.CONFIG['totals']
|
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:
|
if 'duration' in totals:
|
||||||
response['data']['duration'] = r['duration__sum']
|
response['data']['duration'] = r['duration__sum']
|
||||||
|
|
Loading…
Reference in a new issue