From 68a5132cad4e4c4e616fce728d6f0b262c2f2ee5 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Tue, 12 Oct 2010 22:24:56 +0100 Subject: [PATCH] Give directors carte blanche over their corporation's apps --- hr/views.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hr/views.py b/hr/views.py index 272b4d0..1f56aed 100644 --- a/hr/views.py +++ b/hr/views.py @@ -46,10 +46,17 @@ def check_permissions(user, application=None): return HR_ADMIN elif application.user == user: return HR_VIEWONLY - elif hrgroup in user.groups.all(): - corplist = EVEPlayerCharacter.objects.filter(eveaccount__user=user).values_list('corporation__id', flat=True) + else: + # Give admin access to directors of the corp + corplist = EVEPlayerCharacter.objects.filter(director=True,eveaccount__user=user).values_list('corporation__id', flat=True) if application.corporation.id in corplist: return HR_ADMIN + + # Give access to none director HR people access + corplist = EVEPlayerCharacter.objects.filter(eveaccount__user=user).values_list('corporation__id', flat=True) + if application.corporation.id in corplist and hrgroup in user.groups.all(): + return HR_ADMIN + return HR_NONE ### General Views