Skip to content

Commit 76594a4

Browse files
committed
Added support for IRTF liaisons.
- Legacy-Id: 4625
1 parent 554d3a9 commit 76594a4

3 files changed

Lines changed: 104 additions & 6 deletions

File tree

ietf/liaisons/accountsREDESIGN.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ def get_iab_chair():
2323
return None
2424

2525

26+
def get_irtf_chair():
27+
try:
28+
return proxy_personify_role(Role.objects.get(name="chair", group__acronym="irtf"))
29+
except Role.DoesNotExist:
30+
return None
31+
32+
2633
def get_iab_executive_director():
2734
try:
2835
return proxy_personify_role(Role.objects.get(name="execdir", group__acronym="iab"))
@@ -64,6 +71,10 @@ def is_iab_executive_director(person):
6471
return bool(Role.objects.filter(person=person, name="execdir", group__acronym="iab"))
6572

6673

74+
def is_irtfchair(person):
75+
return bool(Role.objects.filter(person=person, name="chair", group__acronym="irtf"))
76+
77+
6778
def can_add_outgoing_liaison(user):
6879
person = get_person_for_user(user)
6980
if not person:

ietf/liaisons/utils.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from ietf.idtracker.models import Area, IETFWG
44
from ietf.liaisons.models import SDOs, LiaisonManagers
5-
from ietf.liaisons.accounts import (is_ietfchair, is_iabchair, is_iab_executive_director,
5+
from ietf.liaisons.accounts import (is_ietfchair, is_iabchair, is_iab_executive_director, is_irtfchair,
66
get_ietf_chair, get_iab_chair, get_iab_executive_director,
77
is_secretariat)
88

@@ -11,6 +11,7 @@
1111
IAB = {'name': u'The IAB', 'address': u'iab@iab.org'}
1212
IABCHAIR = {'name': u'The IAB Chair', 'address': u'iab-chair@iab.org'}
1313
IABEXECUTIVEDIRECTOR = {'name': u'The IAB Executive Director', 'address': u'execd@iab.org'}
14+
IRTFCHAIR = {'name': u'The IRTF Chair', 'address': u'irtf-chair@irtf.org'}
1415

1516

1617
def get_all_sdo_managers():
@@ -88,6 +89,29 @@ def full_user_list(self):
8889
return result
8990

9091

92+
class IRTFEntity(Entity):
93+
94+
poc = FakePerson(**IRTFCHAIR)
95+
96+
def get_from_cc(self, person):
97+
result = []
98+
if not is_irtfchair(person):
99+
result.append(self.poc)
100+
return result
101+
102+
def needs_approval(self, person=None):
103+
if is_irtfchair(person):
104+
return False
105+
return True
106+
107+
def can_approve(self):
108+
return [self.poc]
109+
110+
def full_user_list(self):
111+
result.append(get_irtf_chair())
112+
return result
113+
114+
91115
class IABEntity(Entity):
92116
chair = FakePerson(**IABCHAIR)
93117
director = FakePerson(**IABEXECUTIVEDIRECTOR)
@@ -270,6 +294,26 @@ def can_approve_list(self, person):
270294
return []
271295

272296

297+
class IRTFEntityManager(EntityManager):
298+
299+
def __init__(self, *args, **kwargs):
300+
super(IRTFEntityManager, self).__init__(*args, **kwargs)
301+
self.entity = IRTFEntity(name=self.name)
302+
303+
def get_entity(self, pk=None):
304+
return self.entity
305+
306+
def can_send_on_behalf(self, person):
307+
if is_irtfchair(person):
308+
return self.get_managed_list()
309+
return []
310+
311+
def can_approve_list(self, person):
312+
if is_irtfchair(person):
313+
return self.get_managed_list()
314+
return []
315+
316+
273317
class AreaEntityManager(EntityManager):
274318

275319
def __init__(self, pk=None, name=None, queryset=None):
@@ -358,6 +402,7 @@ def __init__(self):
358402
self.managers = {'ietf': IETFEntityManager(pk='ietf', name=u'The IETF'),
359403
'iesg': IETFEntityManager(pk='iesg', name=u'The IESG'),
360404
'iab': IABEntityManager(pk='iab', name=u'The IAB'),
405+
'irtf': IRTFEntityManager(pk='irtf', name=u'The IAB'),
361406
'area': AreaEntityManager(pk='area', name=u'IETF Areas'),
362407
'wg': WGEntityManager(pk='wg', name=u'IETF Working Groups'),
363408
'sdo': SDOEntityManager(pk='sdo', name=u'Standards Development Organizations'),

ietf/liaisons/utilsREDESIGN.py

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
IAB = {'name': u'The IAB', 'address': u'iab@iab.org'}
1212
IABCHAIR = {'name': u'The IAB Chair', 'address': u'iab-chair@iab.org'}
1313
IABEXECUTIVEDIRECTOR = {'name': u'The IAB Executive Director', 'address': u'execd@iab.org'}
14+
IRTFCHAIR = {'name': u'The IRTF Chair', 'address': u'irtf-chair@irtf.org'}
15+
IESGANDIAB = {'name': u'The IESG and IAB', 'address': u'iesg-iab@ietf.org'}
1416

1517

1618
class FakePerson(object):
@@ -124,10 +126,31 @@ def full_user_list(self):
124126
return result
125127

126128

129+
class IRTFEntity(Entity):
130+
chair = FakePerson(**IRTFCHAIR)
131+
poc = [chair,]
132+
133+
def get_from_cc(self, person):
134+
result = []
135+
return result
136+
137+
def needs_approval(self, person=None):
138+
if is_irtfchair(person):
139+
return False
140+
return True
141+
142+
def can_approve(self):
143+
return [self.chair]
144+
145+
def full_user_list(self):
146+
result = [get_irtf_chair()]
147+
return result
148+
149+
127150
class IAB_IESG_Entity(Entity):
128151

129-
poc = [IABEntity.chair, IABEntity.director, FakePerson(**IETFCHAIR)]
130-
cc = [FakePerson(**IAB), FakePerson(**IESG)]
152+
poc = [IABEntity.chair, IABEntity.director, FakePerson(**IETFCHAIR), FakePerson(**IESGANDIAB), ]
153+
cc = [FakePerson(**IAB), FakePerson(**IESG), FakePerson(**IESGANDIAB)]
131154

132155
def __init__(self, name, obj=None):
133156
self.name = name
@@ -149,9 +172,8 @@ def can_approve(self):
149172
return list(set(self.iab.can_approve() + self.iesg.can_approve()))
150173

151174
def full_user_list(self):
152-
return list(set(self.iab.full_user_list() + self.iesg.full_user_list()))
153-
154-
175+
return [get_ietf_chair(), get_iab_chair(), get_iab_executive_director()]
176+
155177
class AreaEntity(Entity):
156178

157179
def get_poc(self):
@@ -302,6 +324,26 @@ def can_approve_list(self, person):
302324
return []
303325

304326

327+
class IRTFEntityManager(EntityManager):
328+
329+
def __init__(self, *args, **kwargs):
330+
super(IRTFEntityManager, self).__init__(*args, **kwargs)
331+
self.entity = IRTFEntity(name=self.name)
332+
333+
def get_entity(self, pk=None):
334+
return self.entity
335+
336+
def can_send_on_behalf(self, person):
337+
if is_irtfchair(person):
338+
return self.get_managed_list()
339+
return []
340+
341+
def can_approve_list(self, person):
342+
if is_irtfchair(person):
343+
return self.get_managed_list()
344+
return []
345+
346+
305347
class IAB_IESG_EntityManager(EntityManager):
306348

307349
def __init__(self, *args, **kwargs):

0 commit comments

Comments
 (0)