From 9d172f16fa457fbb5b2afe3c35035fae4d3d7b58 Mon Sep 17 00:00:00 2001 From: Graham Gilbert Date: Tue, 31 May 2016 15:23:00 +0100 Subject: [PATCH] Check correct permission: --- server/views.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server/views.py b/server/views.py index ebc1a8d..9bd1582 100644 --- a/server/views.py +++ b/server/views.py @@ -35,11 +35,8 @@ def index(request): if hasattr(settings, 'ALL_APPROVE'): if settings.ALL_APPROVE == True: permissions = Permission.objects.all() - print permissions - for permission in permissions: - print permission.codename permission = Permission.objects.get(codename='can_approve') - if not request.user.has_perm(permission): + if user.has_perm('server.can_approve') == False request.user.user_permissions.add(permission) request.user.save() ##get the number of oustanding requests - approved equals null