totals admin: true -> capability, fixes #2504

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

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']