mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Give directors carte blanche over their corporation's apps
This commit is contained in:
11
hr/views.py
11
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
|
||||
|
||||
Reference in New Issue
Block a user