Restore ADs ability to charter new groups. Fixes #3397. Commit ready for merge,

- Legacy-Id: 19315
This commit is contained in:
Robert Sparks 2021-09-02 23:25:36 +00:00
parent aeff343eee
commit 311b4728e1
2 changed files with 19 additions and 11 deletions

View file

@ -479,11 +479,16 @@ class GroupEditTests(TestCase):
area = Group.objects.filter(type="area").first()
# normal get
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEqual(len(q('form input[name=acronym]')), 1)
for username in ("secretary","ad","irtf-chair"):
self.client.logout()
login_testing_unauthorized(self, username, url)
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEqual(len(q('form input[name=acronym]')), 1)
self.client.logout()
login_testing_unauthorized(self, "secretary", url)
# faulty post
r = self.client.post(url, dict(acronym="foobarbaz")) # No name
self.assertEqual(r.status_code, 200)
@ -527,7 +532,6 @@ class GroupEditTests(TestCase):
def test_create_rg(self):
url = urlreverse('ietf.group.views.edit', kwargs=dict(group_type="rg", action="charter"))
login_testing_unauthorized(self, "secretary", url)
irtf = Group.objects.get(acronym='irtf')
num_rgs = len(Group.objects.filter(type="rg"))
@ -535,11 +539,14 @@ class GroupEditTests(TestCase):
proposed_state = GroupStateName.objects.get(slug="proposed")
# normal get
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEqual(len(q('form input[name=acronym]')), 1)
self.assertEqual(q('form select[name=parent]')[0].value,'%s'%irtf.pk)
for username in ("secretary", "ad", "irtf-chair"):
self.client.logout()
login_testing_unauthorized(self, username, url)
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEqual(len(q('form input[name=acronym]')), 1)
self.assertEqual(q('form select[name=parent]')[0].value,'%s'%irtf.pk)
r = self.client.post(url, dict(acronym="testrg", name="Testing RG", state=proposed_state.pk, parent=irtf.pk))
self.assertEqual(r.status_code, 302)

View file

@ -904,7 +904,8 @@ def edit(request, group_type=None, acronym=None, action="edit", field=None):
or group.has_role(request.user, group.features.groupman_roles)):
permission_denied(request, "You don't have permission to access this view")
else:
if not has_role(request.user, "Secretariat"):
# This allows ADs to create RG and the IRTF Chair to create WG, but we trust them not to
if not has_role(request.user, ("Secretariat", "Area Director", "IRTF Chair")):
permission_denied(request, "You don't have permission to access this view")