Skip to content

Commit a142e89

Browse files
committed
Merged in branch branch/yaco/wgchairs from esanchez@yaco.es. This provides the WG Chair Tracker functionality.
- Legacy-Id: 3120
2 parents 3a2185f + 39c3f6d commit a142e89

105 files changed

Lines changed: 10301 additions & 34 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515
.*.swp
1616
.DS_store
1717
# Simulated Subversion default ignores end here
18+
/.project
19+
/.pydevproject
20+
/.settings

ietf/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/*.pyc
2+
/settings_local.py
3+
/ietfdb.sql.gz

ietf/idrfc/views_doc.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
from ietf.idrfc import markup_txt
5050
from ietf.idrfc.models import RfcIndex, DraftVersions
5151
from ietf.idrfc.idrfc_wrapper import BallotWrapper, IdWrapper, RfcWrapper
52+
from ietf.ietfworkflows.utils import get_full_info_for_draft
5253

5354
def document_debug(request, name):
5455
r = re.compile("^rfc([1-9][0-9]*)$")
@@ -123,25 +124,6 @@ def document_main(request, name, tab):
123124
doc = IdWrapper(id)
124125

125126
info = {}
126-
stream_id = doc.stream_id()
127-
if stream_id == 2:
128-
stream = " (IAB document)"
129-
elif stream_id == 3:
130-
stream = " (IRTF document)"
131-
elif stream_id == 4:
132-
stream = " (Independent submission via RFC Editor)"
133-
elif doc.group_acronym():
134-
stream = " ("+doc.group_acronym().upper()+" WG document)"
135-
else:
136-
stream = " (Individual document)"
137-
138-
if id.status.status == "Active":
139-
info['is_active_draft'] = True
140-
info['type'] = "Active Internet-Draft"+stream
141-
else:
142-
info['is_active_draft'] = False
143-
info['type'] = "Old Internet-Draft"+stream
144-
145127
info['has_pdf'] = (".pdf" in doc.file_types())
146128
info['is_rfc'] = False
147129

@@ -159,6 +141,7 @@ def document_main(request, name, tab):
159141
{'content1':content1, 'content2':content2,
160142
'doc':doc, 'info':info, 'tab':tab,
161143
'include_text':include_text(request),
144+
'stream_info': get_full_info_for_draft(id),
162145
'versions':versions, 'history':history},
163146
context_instance=RequestContext(request));
164147

ietf/idrfc/views_edit.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,5 +380,3 @@ def add_comment(request, name):
380380
dict(doc=doc,
381381
form=form),
382382
context_instance=RequestContext(request))
383-
384-

ietf/idtracker/migrations/0002_shepherd.py

Lines changed: 437 additions & 0 deletions
Large diffs are not rendered by default.

ietf/idtracker/migrations/0003_internet_draft_shepred_fk_blank_true.py

Lines changed: 439 additions & 0 deletions
Large diffs are not rendered by default.

ietf/idtracker/migrations/__init__.py

Whitespace-only changes.

ietf/idtracker/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ class InternetDraft(models.Model):
171171
review_by_rfc_editor = models.BooleanField()
172172
expired_tombstone = models.BooleanField()
173173
idinternal = FKAsOneToOne('idinternal', reverse=True, query=models.Q(rfc_flag = 0))
174+
shepherd = models.ForeignKey('PersonOrOrgInfo', null=True, blank=True)
174175
def __str__(self):
175176
return self.filename
176177
def save(self, *args, **kwargs):
@@ -270,7 +271,7 @@ def __unicode__(self):
270271
return u"(Person #%s)" % self.person_or_org_tag
271272
return u"%s %s" % ( self.first_name or u"<nofirst>", self.last_name or u"<nolast>")
272273
def email(self, priority=1, type=None):
273-
name = str(self)
274+
name = str(self)
274275
email = ''
275276
types = type and [ type ] or [ "INET", "Prim", None ]
276277
for type in types:
@@ -1073,6 +1074,8 @@ class IRTF(models.Model):
10731074
meeting_scheduled = models.BooleanField(blank=True)
10741075
def __str__(self):
10751076
return self.acronym
1077+
def chairs(self): # return a set of IRTFChair objects for this work group
1078+
return IRTFChair.objects.filter(irtf=self)
10761079
class Meta:
10771080
db_table = 'irtf'
10781081
verbose_name="IRTF Research Group"

ietf/ietfworkflows/__init__.py

Whitespace-only changes.

ietf/ietfworkflows/accounts.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
from ietf.ietfworkflows.streams import get_streamed_draft
2+
3+
4+
def get_person_for_user(user):
5+
try:
6+
return user.get_profile().person()
7+
except:
8+
return None
9+
10+
11+
def is_secretariat(user):
12+
if not user or not user.is_authenticated():
13+
return False
14+
return bool(user.groups.filter(name='Secretariat'))
15+
16+
17+
def is_wgchair(person):
18+
return bool(person.wgchair_set.all())
19+
20+
21+
def is_wgdelegate(person):
22+
return bool(person.wgdelegate_set.all())
23+
24+
25+
def is_chair_of_draft(user, draft):
26+
person = get_person_for_user(user)
27+
if not person:
28+
return False
29+
streamed = get_streamed_draft(draft)
30+
if not streamed or not streamed.stream:
31+
return False
32+
group = streamed.group
33+
if not group or not hasattr(group, 'chairs'):
34+
return False
35+
return bool(group.chairs().filter(person=person).count())
36+
37+
38+
def can_edit_state(user, draft):
39+
streamed = get_streamed_draft(draft)
40+
if not streamed or not streamed.stream:
41+
person = get_person_for_user(user)
42+
if not person:
43+
return False
44+
return (is_secretariat(user) or
45+
is_wgchair(person) or
46+
is_wgdelegate(person))
47+
return (is_secretariat(user) or
48+
is_chair_of_draft(user, draft))
49+
50+
51+
def can_edit_stream(user, draft):
52+
return is_secretariat(user)

0 commit comments

Comments
 (0)