Swap the arguments to group.has_role so they match the arguments to
the existing has_role - Legacy-Id: 6218
This commit is contained in:
parent
0eed4ad9e5
commit
5924024513
ietf
|
@ -54,8 +54,10 @@ class Group(GroupInfo):
|
|||
e = model.objects.filter(group=self).filter(**filter_args).order_by('-time', '-id')[:1]
|
||||
return e[0] if e else None
|
||||
|
||||
def has_role(self, role_name, user):
|
||||
return user.is_authenticated() and self.role_set.filter(name=role_name, person__user=user).exists()
|
||||
def has_role(self, user, role_names):
|
||||
if isinstance(role_names, str) or isinstance(role_names, unicode):
|
||||
role_names = [role_names]
|
||||
return user.is_authenticated() and self.role_set.filter(name__in=role_names, person__user=user).exists()
|
||||
|
||||
def get_chair(self):
|
||||
chair = self.role_set.filter(name__slug='chair')[:1]
|
||||
|
|
|
@ -24,7 +24,7 @@ def is_chair(user, year):
|
|||
nomcom = get_nomcom_by_year(year=year)
|
||||
if has_role(user, "Secretariat"):
|
||||
return True
|
||||
return nomcom.group.has_role("chair", user)
|
||||
return nomcom.group.has_role(user, "chair")
|
||||
|
||||
|
||||
@register.filter
|
||||
|
|
|
@ -81,7 +81,7 @@ def private_key(request, year):
|
|||
def private_index(request, year):
|
||||
nomcom = get_nomcom_by_year(year)
|
||||
all_nominee_positions = NomineePosition.objects.get_by_nomcom(nomcom).not_duplicated()
|
||||
is_chair = nomcom.group.has_role("chair", request.user)
|
||||
is_chair = nomcom.group.has_role(request.user, "chair")
|
||||
message = None
|
||||
if is_chair and request.method == 'POST':
|
||||
action = request.POST.get('action')
|
||||
|
|
Loading…
Reference in a new issue