mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 11:59:23 +00:00
Small fix (le gaulois)
This commit is contained in:
@ -8,7 +8,7 @@ from django.core.exceptions import ValidationError
|
||||
|
||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin
|
||||
from club.models import Club, Membership
|
||||
from sith.settings import AE_GROUPS
|
||||
from sith.settings import AE_GROUPS, MAXIMUM_FREE_ROLE
|
||||
|
||||
class ClubListView(CanViewMixin, ListView):
|
||||
"""
|
||||
@ -42,7 +42,10 @@ class ClubMemberForm(forms.ModelForm):
|
||||
"""
|
||||
ret = super(ClubMemberForm, self).clean()
|
||||
ms = self.instance.club.get_membership_for(self._user)
|
||||
if (ms is not None and ms.role >= self.cleaned_data['role']) or self._user.is_in_group(AE_GROUPS['board']['name']) or self._user.is_superuser:
|
||||
if (self.cleaned_data['role'] <= MAXIMUM_FREE_ROLE or
|
||||
(ms is not None and ms.role >= self.cleaned_data['role']) or
|
||||
self._user.is_in_group(AE_GROUPS['board']['name']) or
|
||||
self._user.is_superuser):
|
||||
return ret
|
||||
raise ValidationError("You do not have the permission to do that")
|
||||
|
||||
|
Reference in New Issue
Block a user