Fixed a bug in which operations were available on the /group/chartering/ 'Chartering or re-chartering' page, so that not only operations on groups in a chartering state is shown, but also the options to start chartering. Fixes issue #2312.
- Legacy-Id: 13584
This commit is contained in:
parent
a9785674ea
commit
f5298d7bb8
|
@ -152,6 +152,10 @@ class GroupPagesTests(TestCase):
|
|||
q = PyQuery(r.content)
|
||||
self.assertEqual(len(q('#content a:contains("%s")' % group.acronym)), 1)
|
||||
|
||||
self.client.login(username="secretary", password="secretary+password")
|
||||
r = self.client.get(url)
|
||||
self.assertContains(r, "Charter new RG")
|
||||
|
||||
def test_concluded_groups(self):
|
||||
draft = make_test_data()
|
||||
group = draft.group
|
||||
|
|
|
@ -92,17 +92,19 @@ def save_milestone_in_history(milestone):
|
|||
|
||||
return h
|
||||
|
||||
def can_manage_group_type(user, group):
|
||||
if group.type_id == "rg":
|
||||
def can_manage_group_type(user, group, type_id=None):
|
||||
if type_id is None:
|
||||
type_id = group.type_id
|
||||
if type_id == "rg":
|
||||
return has_role(user, ('IRTF Chair', 'Secretariat'))
|
||||
elif group.type_id == "wg":
|
||||
elif type_id == "wg":
|
||||
return has_role(user, ('Area Director', 'Secretariat'))
|
||||
elif group.type_id == "team":
|
||||
if group.is_decendant_of("ietf"):
|
||||
elif type_id == "team":
|
||||
if group and group.is_decendant_of("ietf"):
|
||||
return has_role(user, ('Area Director', 'Secretariat'))
|
||||
elif group.is_decendant_of("irtf"):
|
||||
elif group and group.is_decendant_of("irtf"):
|
||||
return has_role(user, ('IRTF Chair', 'Secretariat'))
|
||||
elif group.type_id == "program":
|
||||
elif type_id == "program":
|
||||
return has_role(user, ('IAB', 'Secretariat',))
|
||||
return has_role(user, ('Secretariat'))
|
||||
|
||||
|
|
|
@ -305,10 +305,7 @@ def chartering_groups(request):
|
|||
|
||||
for t in group_types:
|
||||
t.chartering_groups = Group.objects.filter(type=t, charter__states__in=charter_states).select_related("state", "charter").order_by("acronym")
|
||||
if t.chartering_groups.exists():
|
||||
t.can_manage = can_manage_group_type(request.user, t.chartering_groups.first())
|
||||
else:
|
||||
t.can_manage = False
|
||||
t.can_manage = can_manage_group_type(request.user, None, t)
|
||||
|
||||
for g in t.chartering_groups:
|
||||
g.chartering_type = get_chartering_type(g.charter)
|
||||
|
|
Loading…
Reference in a new issue