Skip to content

Commit 96602e1

Browse files
committed
Merged in [19030] from mark@painless-security.com:
First swipe at making past sessions unchangable for official schedules This change locks down the schedule of any meeting that is fully in the past. It leaves open sessions that have finished for meetings that have not yet finished. Addresses (partially) issue ietf-tools#3083. - Legacy-Id: 19063 Note: SVN reference [19030] has been migrated to Git commit e3ee370
2 parents 11d420b + e3ee370 commit 96602e1

5 files changed

Lines changed: 65 additions & 3 deletions

File tree

ietf/meeting/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def schedule_permissions(meeting, schedule, user):
358358

359359
if user_is_person(user, schedule.owner):
360360
cansee = True
361-
canedit = True
361+
canedit = not schedule.is_official_record
362362

363363
return cansee, canedit, secretariat
364364

ietf/meeting/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,11 @@ def owner_email(self):
684684
def is_official(self):
685685
return (self.meeting.schedule == self)
686686

687+
@property
688+
def is_official_record(self):
689+
return (self.is_official and
690+
self.meeting.end_date() <= datetime.date.today() )
691+
687692
# returns a dictionary {group -> [schedtimesessassignment+]}
688693
# and it has [] if the session is not placed.
689694
# if there is more than one session for that group,

ietf/meeting/tests_views.py

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,55 @@ def test_edit_schedule(self):
12211221
self.client.login(username="secretary", password="secretary+password")
12221222
r = self.client.get(urlreverse("ietf.meeting.views.edit_schedule", kwargs=dict(num=meeting.number)))
12231223
self.assertContains(r, "load_assignments")
1224-
1224+
1225+
def test_official_record_schedule_is_read_only(self):
1226+
def _set_date_offset_and_retrieve_page(meeting, days_offset, client):
1227+
meeting.date = datetime.date.today() + datetime.timedelta(days=days_offset)
1228+
meeting.save()
1229+
client.login(username="secretary", password="secretary+password")
1230+
url = urlreverse("ietf.meeting.views.edit_meeting_schedule", kwargs=dict(num=meeting.number))
1231+
r = client.get(url)
1232+
q = PyQuery(r.content)
1233+
return(r, q)
1234+
1235+
# Setup
1236+
####################################################################################
1237+
1238+
# Basic test data
1239+
meeting = make_meeting_test_data()
1240+
1241+
# Set the secretary as the owner of the schedule
1242+
schedule = meeting.schedule
1243+
schedule.owner = Person.objects.get(user__username="secretary")
1244+
schedule.save()
1245+
1246+
# Tests
1247+
####################################################################################
1248+
1249+
# 1) Check that we get told the page is not editable
1250+
#######################################################
1251+
r, q = _set_date_offset_and_retrieve_page(meeting,
1252+
0 - 2 - meeting.days, # Meeting ended 2 days ago
1253+
self.client)
1254+
self.assertTrue(q("""em:contains("You can't edit this schedule")"""))
1255+
self.assertTrue(q("""em:contains("This is the official schedule for a meeting in the past")"""))
1256+
1257+
# 2) An ongoing meeting
1258+
#######################################################
1259+
r, q = _set_date_offset_and_retrieve_page(meeting,
1260+
0, # Meeting starts today
1261+
self.client)
1262+
self.assertFalse(q("""em:contains("You can't edit this schedule")"""))
1263+
self.assertFalse(q("""em:contains("This is the official schedule for a meeting in the past")"""))
1264+
1265+
# 3) A meeting in the future
1266+
#######################################################
1267+
r, q = _set_date_offset_and_retrieve_page(meeting,
1268+
7, # Meeting starts next week
1269+
self.client)
1270+
self.assertFalse(q("""em:contains("You can't edit this schedule")"""))
1271+
self.assertFalse(q("""em:contains("This is the official schedule for a meeting in the past")"""))
1272+
12251273
def test_edit_meeting_schedule(self):
12261274
meeting = make_meeting_test_data()
12271275

ietf/templates/meeting/edit_meeting_schedule.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@
4646
{% if not can_edit %}
4747
&middot;
4848

49-
<strong><em>You can't edit this schedule. Make a <a href="{% url "ietf.meeting.views.new_meeting_schedule" num=meeting.number owner=schedule.owner_email name=schedule.name %}">new agenda from this</a>.</em></strong>
49+
<strong>
50+
<em>
51+
You can't edit this schedule.
52+
{% if schedule.is_official_record %}This is the official schedule for a meeting in the past.{% endif %}
53+
Make a <a href="{% url "ietf.meeting.views.new_meeting_schedule" num=meeting.number owner=schedule.owner_email name=schedule.name %}">new agenda from this</a>.
54+
</em>
55+
</strong>
5056
{% endif %}
5157
</p>
5258

ietf/templates/meeting/landscape_edit.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@
107107
{% origin %}
108108
<div id="read_only">
109109
<p>You do not have write permission to agenda: {{schedule.name}}</p>
110+
{% if schedule.is_official_record %}
111+
<p>This is the official schedule for a meeting in the past.</p>
112+
{% endif %}
110113
<p>Please save this agenda to your account first.</p>
111114
</div>
112115

0 commit comments

Comments
 (0)