Skip to content

Commit 40fd78a

Browse files
committed
Merged in [14103] from rcross@amsl.com:
Change announcement tool access function to use data from AnnouncementFrom objects. Fixes ietf-tools#2362. - Legacy-Id: 14108 Note: SVN reference [14103] has been migrated to Git commit a85a762
2 parents 135d5d9 + a85a762 commit 40fd78a

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

ietf/secr/announcement/views.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from django.shortcuts import render, redirect
55

66
from ietf.group.models import Role
7+
from ietf.message.models import AnnouncementFrom
78
from ietf.ietfauth.utils import has_role
89
from ietf.secr.announcement.forms import AnnounceForm
910
from ietf.secr.utils.decorators import check_for_cancel
@@ -19,25 +20,19 @@ def check_access(user):
1920
'''
2021
if hasattr(user, "person"):
2122
person = user.person
22-
groups_with_access = ("iab", "isoc", "isocbot", "rsoc", "ietf", "iaoc", "rse", "mentor","ietf-trust")
23-
if Role.objects.filter(person=person,
24-
group__acronym__in=groups_with_access,
25-
name="chair") or has_role(user, ["Secretariat","IAD"]):
23+
if has_role(user, "Secretariat"):
2624
return True
25+
26+
for role in person.role_set.all():
27+
if AnnouncementFrom.objects.filter(name=role.name,group=role.group):
28+
return True
29+
2730
if Role.objects.filter(name="chair",
2831
group__acronym__startswith="nomcom",
2932
group__state="active",
3033
group__type="nomcom",
3134
person=person):
3235
return True
33-
if Role.objects.filter(person=person,
34-
group__acronym='iab',
35-
name='execdir'):
36-
return True
37-
if Role.objects.filter(person=person,
38-
group__acronym='isoc',
39-
name='ceo'):
40-
return True
4136

4237
return False
4338

0 commit comments

Comments
 (0)