Changes from esanchez@yaco.es, changesets 2783-2789. Lets the secretariat send liaisons on behalf of others, corrected powers to liaison managers, and other fixes.
- Legacy-Id: 2800
This commit is contained in:
commit
63bc9cff6d
28
changelog
28
changelog
|
@ -18,6 +18,34 @@ ietfdb (3.12)
|
|||
* Renamed 'LiaisonDetail.taken_care' field to 'action_taken'.
|
||||
Miscellaneous associated fixes. Enhanced liaison-related admin pages.
|
||||
|
||||
Note: Deploying this release requires additional steps; to verify
|
||||
that liaison related settings in settings.py are correct, and to create
|
||||
new tables and update existing tables and table content. The latter
|
||||
is done as South migrations (see http://south.aeracode.org/ for more
|
||||
info on the South app). More extensiive documentation about the actions
|
||||
needed are provided in the user manual (doc/LSMT_user_manual.pdf in
|
||||
the release). The brief version follows:
|
||||
|
||||
# 8<----------
|
||||
# First the regular checkout and prepare:
|
||||
|
||||
cd /a/www/ietf-datatracker
|
||||
svn co http://svn.tools.ietf.org/svn/tools/ietfdb/tags/3.12
|
||||
cp web/ietf/settings_local.py 3.12/ietf/
|
||||
cd 3.12
|
||||
|
||||
# Next, apply the migrations:
|
||||
|
||||
PYTHONPATH=$PWD ietf/manage.py migrate liaisons
|
||||
|
||||
# Then carry on with the usual actions:
|
||||
|
||||
cd ../
|
||||
rm ./web; ln -s 3.12 web
|
||||
sudo /etc/init.d/apache restart
|
||||
|
||||
# 8<----------
|
||||
|
||||
-- Henrik Levkowetz <henrik@levkowetz.com> 28 Jan 2011 13:15:40 +0100
|
||||
|
||||
ietfdb (3.11)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from ietf.idtracker.models import Role, PersonOrOrgInfo
|
||||
|
||||
|
||||
LIAISON_EDIT_GROUPS = ['Liaison_Manager', 'Secretariat']
|
||||
LIAISON_EDIT_GROUPS = ['Secretariat']
|
||||
|
||||
|
||||
def get_ietf_chair():
|
||||
person = PersonOrOrgInfo.objects.filter(role=Role.IETF_CHAIR)
|
||||
|
@ -65,7 +66,7 @@ def can_add_outgoing_liaison(user):
|
|||
if (is_areadirector(person) or is_wgchair(person) or
|
||||
is_wgsecretary(person) or is_ietfchair(person) or
|
||||
is_iabchair(person) or is_iab_executive_director(person) or
|
||||
is_ietf_liaison_manager(user)):
|
||||
is_sdo_liaison_manager(person) or is_secretariat(user)):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -78,8 +79,8 @@ def is_sdo_authorized_individual(person):
|
|||
return bool(person.sdoauthorizedindividual_set.all())
|
||||
|
||||
|
||||
def is_ietf_liaison_manager(user):
|
||||
return bool(user.groups.filter(name='Liaison_Manager'))
|
||||
def is_secretariat(user):
|
||||
return bool(user.groups.filter(name='Secretariat'))
|
||||
|
||||
|
||||
def can_add_incoming_liaison(user):
|
||||
|
@ -89,10 +90,51 @@ def can_add_incoming_liaison(user):
|
|||
|
||||
if (is_sdo_liaison_manager(person) or
|
||||
is_sdo_authorized_individual(person) or
|
||||
is_ietf_liaison_manager(user)):
|
||||
is_secretariat(user)):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def can_add_liaison(user):
|
||||
return can_add_incoming_liaison(user) or can_add_outgoing_liaison(user)
|
||||
|
||||
|
||||
def is_sdo_manager_for_outgoing_liaison(person, liaison):
|
||||
from ietf.liaisons.utils import IETFHM, SDOEntity
|
||||
from ietf.liaisons.models import SDOs
|
||||
from_entity = IETFHM.get_entity_by_key(liaison.from_raw_code)
|
||||
sdo = None
|
||||
if not from_entity:
|
||||
sdo = SDOs.objects.get(sdo_name=liaison.from_body())
|
||||
elif isinstance(from_entity, SDOEntity):
|
||||
sdo = from_entity.obj
|
||||
if sdo:
|
||||
return bool(sdo.liaisonmanagers_set.filter(person=person))
|
||||
return False
|
||||
|
||||
|
||||
def is_sdo_manager_for_incoming_liaison(person, liaison):
|
||||
from ietf.liaisons.utils import IETFHM, SDOEntity
|
||||
from ietf.liaisons.models import SDOs
|
||||
to_entity = IETFHM.get_entity_by_key(liaison.to_raw_code)
|
||||
sdo = None
|
||||
if not to_entity:
|
||||
try:
|
||||
sdo = SDOs.objects.get(sdo_name=liaison.to_body)
|
||||
except SDOs.DoesNotExist:
|
||||
pass
|
||||
elif isinstance(to_entity, SDOEntity):
|
||||
sdo = to_entity.obj
|
||||
if sdo:
|
||||
return bool(sdo.liaisonmanagers_set.filter(person=person))
|
||||
return False
|
||||
|
||||
|
||||
def can_edit_liaison(user, liaison):
|
||||
if is_secretariat(user):
|
||||
return True
|
||||
person = get_person_for_user(user)
|
||||
if is_sdo_liaison_manager(person):
|
||||
return (is_sdo_manager_for_outgoing_liaison(person, liaison) or
|
||||
is_sdo_manager_for_incoming_liaison(person, liaison))
|
||||
return False
|
||||
|
|
|
@ -8,8 +8,9 @@ from django.forms.util import ErrorList
|
|||
from django.forms.fields import email_re
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
from ietf.idtracker.models import PersonOrOrgInfo
|
||||
from ietf.liaisons.accounts import (can_add_outgoing_liaison, can_add_incoming_liaison,
|
||||
get_person_for_user, is_ietf_liaison_manager)
|
||||
get_person_for_user, is_secretariat, is_sdo_liaison_manager)
|
||||
from ietf.liaisons.models import LiaisonDetail, Uploads, OutgoingLiaisonApproval, SDOs
|
||||
from ietf.liaisons.utils import IETFHM
|
||||
from ietf.liaisons.widgets import (FromWidget, ReadOnlyWidget, ButtonWidget,
|
||||
|
@ -61,6 +62,9 @@ class LiaisonForm(forms.ModelForm):
|
|||
self.person = get_person_for_user(user)
|
||||
if kwargs.get('data', None):
|
||||
kwargs['data'].update({'person': self.person.pk})
|
||||
if is_secretariat(self.user) and 'from_fake_user' in kwargs['data'].keys():
|
||||
fake_person = PersonOrOrgInfo.objects.get(pk=kwargs['data']['from_fake_user'])
|
||||
kwargs['data'].update({'person': fake_person.pk})
|
||||
super(LiaisonForm, self).__init__(*args, **kwargs)
|
||||
self.hm = IETFHM
|
||||
self.set_from_field()
|
||||
|
@ -186,6 +190,7 @@ class LiaisonForm(forms.ModelForm):
|
|||
liaison.from_raw_body = from_entity.name
|
||||
liaison.from_raw_code = self.cleaned_data.get('from_field')
|
||||
organization = self.get_to_entity()
|
||||
liaison.to_raw_code = self.cleaned_data.get('organization')
|
||||
liaison.to_body = organization.name
|
||||
liaison.to_poc = self.get_poc(organization)
|
||||
liaison.submitter_name, liaison.submitter_email = self.person.email()
|
||||
|
@ -228,7 +233,7 @@ class LiaisonForm(forms.ModelForm):
|
|||
class IncomingLiaisonForm(LiaisonForm):
|
||||
|
||||
def set_from_field(self):
|
||||
if is_ietf_liaison_manager(self.user):
|
||||
if is_secretariat(self.user):
|
||||
sdos = SDOs.objects.all()
|
||||
else:
|
||||
sdo_managed = [i.sdo for i in self.person.liaisonmanagers_set.all()]
|
||||
|
@ -241,7 +246,8 @@ class IncomingLiaisonForm(LiaisonForm):
|
|||
self.fields['organization'].choices = self.hm.get_all_incoming_entities()
|
||||
|
||||
def get_post_only(self):
|
||||
if self.user.groups.filter(name='Liaison_Manager'):
|
||||
from_entity = self.get_from_entity()
|
||||
if self.person.liaisonmanagers_set.filter(sdo=from_entity.obj):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -265,7 +271,7 @@ class OutgoingLiaisonForm(LiaisonForm):
|
|||
return organization
|
||||
|
||||
def set_from_field(self):
|
||||
if is_ietf_liaison_manager(self.user):
|
||||
if is_secretariat(self.user) or is_sdo_liaison_manager(self.person):
|
||||
self.fields['from_field'].choices = self.hm.get_all_incoming_entities()
|
||||
else:
|
||||
self.fields['from_field'].choices = self.hm.get_entities_for_person(self.person)
|
||||
|
@ -273,7 +279,11 @@ class OutgoingLiaisonForm(LiaisonForm):
|
|||
self.fieldsets[0] = ('From', ('from_field', 'replyto', 'approved'))
|
||||
|
||||
def set_organization_field(self):
|
||||
self.fields['organization'].choices = self.hm.get_all_outgoing_entities()
|
||||
if is_sdo_liaison_manager(self.person):
|
||||
sdos = [i.sdo for i in self.person.liaisonmanagers_set.all().distinct()]
|
||||
self.fields['organization'].choices = [('sdo_%s' % i.pk, i.sdo_name) for i in sdos]
|
||||
else:
|
||||
self.fields['organization'].choices = self.hm.get_all_outgoing_entities()
|
||||
self.fieldsets[1] = ('To', ('organization', 'other_organization', 'to_poc'))
|
||||
|
||||
def set_required_fields(self):
|
||||
|
|
117
ietf/liaisons/migrations/0010_add_to_raw_code.py
Normal file
117
ietf/liaisons/migrations/0010_add_to_raw_code.py
Normal file
|
@ -0,0 +1,117 @@
|
|||
|
||||
from south.db import db
|
||||
from django.db import models
|
||||
from ietf.liaisons.models import *
|
||||
|
||||
class Migration:
|
||||
|
||||
def forwards(self, orm):
|
||||
|
||||
# Adding field 'LiaisonDetail.to_raw_code'
|
||||
db.add_column('liaison_detail', 'to_raw_code', orm['liaisons.liaisondetail:to_raw_code'])
|
||||
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
# Deleting field 'LiaisonDetail.to_raw_code'
|
||||
db.delete_column('liaison_detail', 'to_raw_code')
|
||||
|
||||
|
||||
|
||||
models = {
|
||||
'idtracker.personororginfo': {
|
||||
'Meta': {'db_table': "'person_or_org_info'"},
|
||||
'address_type': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}),
|
||||
'created_by': ('django.db.models.fields.CharField', [], {'max_length': '8', 'null': 'True', 'blank': 'True'}),
|
||||
'date_created': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
|
||||
'date_modified': ('django.db.models.fields.DateField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
|
||||
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
|
||||
'first_name_key': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
|
||||
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
|
||||
'last_name_key': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
|
||||
'middle_initial': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}),
|
||||
'middle_initial_key': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}),
|
||||
'modified_by': ('django.db.models.fields.CharField', [], {'max_length': '8', 'null': 'True', 'blank': 'True'}),
|
||||
'name_prefix': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
|
||||
'name_suffix': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
|
||||
'person_or_org_tag': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'record_type': ('django.db.models.fields.CharField', [], {'max_length': '8', 'null': 'True', 'blank': 'True'})
|
||||
},
|
||||
'liaisons.frombodies': {
|
||||
'Meta': {'db_table': "'from_bodies'"},
|
||||
'body_name': ('django.db.models.fields.CharField', [], {'max_length': '35', 'blank': 'True'}),
|
||||
'email_priority': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'from_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_liaison_manager': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'other_sdo': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'poc': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['idtracker.PersonOrOrgInfo']", 'null': 'True', 'db_column': "'poc'"})
|
||||
},
|
||||
'liaisons.liaisondetail': {
|
||||
'Meta': {'db_table': "'liaison_detail'"},
|
||||
'approval': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['liaisons.OutgoingLiaisonApproval']", 'null': 'True', 'blank': 'True'}),
|
||||
'body': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'by_secretariat': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'cc1': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'cc2': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
|
||||
'deadline_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'detail_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'from_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'from_raw_body': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'from_raw_code': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'last_modified_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['idtracker.PersonOrOrgInfo']", 'null': 'True', 'db_column': "'person_or_org_tag'"}),
|
||||
'purpose': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['liaisons.LiaisonPurpose']", 'null': 'True'}),
|
||||
'purpose_text': ('django.db.models.fields.TextField', [], {'null': 'True', 'db_column': "'purpose'", 'blank': 'True'}),
|
||||
'related_to': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['liaisons.LiaisonDetail']", 'null': 'True', 'blank': 'True'}),
|
||||
'replyto': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'response_contact': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'submitted_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'submitter_email': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'submitter_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'taken_care': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||
'technical_contact': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'to_body': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'to_email': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'to_poc': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'to_raw_code': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
|
||||
},
|
||||
'liaisons.liaisonmanagers': {
|
||||
'Meta': {'db_table': "'liaison_managers'"},
|
||||
'email_priority': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['idtracker.PersonOrOrgInfo']", 'db_column': "'person_or_org_tag'"}),
|
||||
'sdo': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['liaisons.SDOs']"})
|
||||
},
|
||||
'liaisons.liaisonpurpose': {
|
||||
'Meta': {'db_table': "'liaison_purpose'"},
|
||||
'purpose_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'purpose_text': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'})
|
||||
},
|
||||
'liaisons.outgoingliaisonapproval': {
|
||||
'approval_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'approved': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||
},
|
||||
'liaisons.sdoauthorizedindividual': {
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['idtracker.PersonOrOrgInfo']", 'db_column': "'person_or_org_tag'"}),
|
||||
'sdo': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['liaisons.SDOs']"})
|
||||
},
|
||||
'liaisons.sdos': {
|
||||
'Meta': {'db_table': "'sdos'"},
|
||||
'sdo_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'sdo_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})
|
||||
},
|
||||
'liaisons.uploads': {
|
||||
'Meta': {'db_table': "'uploads'"},
|
||||
'detail': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['liaisons.LiaisonDetail']"}),
|
||||
'file_extension': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
|
||||
'file_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'file_title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
|
||||
'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['idtracker.PersonOrOrgInfo']", 'db_column': "'person_or_org_tag'"})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['liaisons']
|
|
@ -64,6 +64,7 @@ class LiaisonDetail(models.Model):
|
|||
replyto = models.CharField(blank=True, null=True, max_length=255)
|
||||
from_raw_body = models.CharField(blank=True, null=True, max_length=255)
|
||||
from_raw_code = models.CharField(blank=True, null=True, max_length=255)
|
||||
to_raw_code = models.CharField(blank=True, null=True, max_length=255)
|
||||
approval = models.ForeignKey(OutgoingLiaisonApproval, blank=True, null=True)
|
||||
action_taken = models.BooleanField(default=False, db_column='taken_care')
|
||||
related_to = models.ForeignKey('LiaisonDetail', blank=True, null=True)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from ietf.idtracker.models import Area, IETFWG
|
||||
from ietf.liaisons.models import SDOs
|
||||
from ietf.liaisons.accounts import is_ietfchair, is_iabchair, is_iab_executive_director
|
||||
from ietf.liaisons.models import SDOs, LiaisonManagers
|
||||
from ietf.liaisons.accounts import (is_ietfchair, is_iabchair, is_iab_executive_director,
|
||||
get_ietf_chair, get_iab_chair, get_iab_executive_director)
|
||||
|
||||
IETFCHAIR = {'name': u'The IETF Chair', 'address': u'chair@ietf.org'}
|
||||
IESG = {'name': u'The IESG', 'address': u'iesg@ietf.org'}
|
||||
|
@ -9,6 +10,10 @@ IABCHAIR = {'name': u'The IAB Chair', 'address': u'iab-chair@iab.org'}
|
|||
IABEXECUTIVEDIRECTOR = {'name': u'The IAB Executive Director', 'address': u'execd@iab.org'}
|
||||
|
||||
|
||||
def get_all_sdo_managers():
|
||||
return [i.person for i in LiaisonManagers.objects.all().distinct()]
|
||||
|
||||
|
||||
class FakePerson(object):
|
||||
|
||||
def __init__(self, name, address):
|
||||
|
@ -47,6 +52,12 @@ class Entity(object):
|
|||
def can_approve(self):
|
||||
return []
|
||||
|
||||
def post_only(self, person):
|
||||
return False
|
||||
|
||||
def full_user_list(self):
|
||||
return False
|
||||
|
||||
|
||||
class IETFEntity(Entity):
|
||||
|
||||
|
@ -68,6 +79,11 @@ class IETFEntity(Entity):
|
|||
def can_approve(self):
|
||||
return [self.poc]
|
||||
|
||||
def full_user_list(self):
|
||||
result = get_all_sdo_managers()
|
||||
result.append(get_ietf_chair())
|
||||
return result
|
||||
|
||||
|
||||
class IABEntity(Entity):
|
||||
chair = FakePerson(**IABCHAIR)
|
||||
|
@ -92,6 +108,11 @@ class IABEntity(Entity):
|
|||
def can_approve(self):
|
||||
return [self.chair]
|
||||
|
||||
def full_user_list(self):
|
||||
result = get_all_sdo_managers()
|
||||
result += [get_iab_chair(), get_iab_executive_director()]
|
||||
return result
|
||||
|
||||
|
||||
class AreaEntity(Entity):
|
||||
|
||||
|
@ -115,6 +136,11 @@ class AreaEntity(Entity):
|
|||
def can_approve(self):
|
||||
return self.get_poc()
|
||||
|
||||
def full_user_list(self):
|
||||
result = get_all_sdo_managers()
|
||||
result += self.get_poc()
|
||||
return result
|
||||
|
||||
|
||||
class WGEntity(Entity):
|
||||
|
||||
|
@ -145,6 +171,11 @@ class WGEntity(Entity):
|
|||
def can_approve(self):
|
||||
return [i.person for i in self.obj.area.area.areadirector_set.all()]
|
||||
|
||||
def full_user_list(self):
|
||||
result = get_all_sdo_managers()
|
||||
result += self.get_poc()
|
||||
return result
|
||||
|
||||
|
||||
class SDOEntity(Entity):
|
||||
|
||||
|
@ -163,6 +194,14 @@ class SDOEntity(Entity):
|
|||
return [manager.person]
|
||||
return []
|
||||
|
||||
def post_only(self, person):
|
||||
return bool(self.obj.liaisonmanagers_set.filter(person=person))
|
||||
|
||||
def full_user_list(self):
|
||||
result = [i.person for i in self.obj.liaisonmanagers_set.all().distinct()]
|
||||
result += [i.person for i in self.obj.sdoauthorizedindividual_set.all().distinct()]
|
||||
return result
|
||||
|
||||
|
||||
class EntityManager(object):
|
||||
|
||||
|
@ -321,6 +360,8 @@ class IETFHierarchyManager(object):
|
|||
}
|
||||
|
||||
def get_entity_by_key(self, entity_id):
|
||||
if not entity_id:
|
||||
return None
|
||||
id_list = entity_id.split('_', 1)
|
||||
key = id_list[0]
|
||||
pk = None
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.conf import settings
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.db.models import Q
|
||||
from django.forms.fields import email_re
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.utils import simplejson
|
||||
|
@ -14,7 +14,8 @@ from django.views.generic.list_detail import object_list, object_detail
|
|||
|
||||
from ietf.liaisons.accounts import (get_person_for_user, can_add_outgoing_liaison,
|
||||
can_add_incoming_liaison, LIAISON_EDIT_GROUPS,
|
||||
is_ietfchair, is_iabchair, is_iab_executive_director)
|
||||
is_ietfchair, is_iabchair, is_iab_executive_director,
|
||||
can_edit_liaison, is_secretariat)
|
||||
from ietf.liaisons.decorators import can_submit_liaison
|
||||
from ietf.liaisons.forms import liaison_form_factory
|
||||
from ietf.liaisons.models import LiaisonDetail, OutgoingLiaisonApproval
|
||||
|
@ -52,7 +53,7 @@ def get_info(request):
|
|||
to_entity_id = request.GET.get('to_entity_id', None)
|
||||
from_entity_id = request.GET.get('from_entity_id', None)
|
||||
|
||||
result = {'poc': [], 'cc': [], 'needs_approval': False}
|
||||
result = {'poc': [], 'cc': [], 'needs_approval': False, 'post_only': False, 'full_list': []}
|
||||
|
||||
to_error = 'Invalid TO entity id'
|
||||
if to_entity_id:
|
||||
|
@ -73,7 +74,13 @@ def get_info(request):
|
|||
'cc': [i.email() for i in to_entity.get_cc(person=person)] +\
|
||||
[i.email() for i in from_entity.get_from_cc(person=person)],
|
||||
'poc': [i.email() for i in to_entity.get_poc()],
|
||||
'needs_approval': from_entity.needs_approval(person=person)})
|
||||
'needs_approval': from_entity.needs_approval(person=person),
|
||||
'post_only': from_entity.post_only(person=person)})
|
||||
if is_secretariat(request.user):
|
||||
full_list = [(i.pk, i.email()) for i in from_entity.full_user_list()]
|
||||
full_list.sort(lambda x,y: cmp(x[1], y[1]))
|
||||
full_list = [(person.pk, person.email())] + full_list
|
||||
result.update({'full_list': full_list})
|
||||
json_result = simplejson.dumps(result)
|
||||
return HttpResponse(json_result, mimetype='text/javascript')
|
||||
|
||||
|
@ -210,7 +217,7 @@ def liaison_detail(request, object_id):
|
|||
can_edit = False
|
||||
user = request.user
|
||||
can_take_care = _can_take_care(liaison, user)
|
||||
if user.is_authenticated() and user.groups.filter(name__in=LIAISON_EDIT_GROUPS):
|
||||
if user.is_authenticated() and can_edit_liaison(user, liaison):
|
||||
can_edit = True
|
||||
if request.method == 'POST' and request.POST.get('do_action_taken', None) and can_take_care:
|
||||
liaison.action_taken = True
|
||||
|
@ -227,6 +234,9 @@ def liaison_detail(request, object_id):
|
|||
|
||||
def liaison_edit(request, object_id):
|
||||
liaison = get_object_or_404(LiaisonDetail, pk=object_id)
|
||||
user = request.user
|
||||
if not (user.is_authenticated() and can_edit_liaison(user, liaison)):
|
||||
return HttpResponseForbidden('You have no permission to edit this liaison')
|
||||
return add_liaison(request, liaison=liaison)
|
||||
|
||||
def ajax_liaison_list(request):
|
||||
|
|
20
ietf/templates/liaisons/liaison_deadline_mail.txt
Normal file
20
ietf/templates/liaisons/liaison_deadline_mail.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
The following liaison {{ days_msg }}. Plase take actions.
|
||||
|
||||
Title: {{ liaison.title }}
|
||||
Submission Date: {{ liaison.submitted_date }}
|
||||
URL of the IETF Web page: {% url liaison_detail object_id=liaison.pk %}
|
||||
{% if liaison.deadline_date %}Please reply by {{ liaison.deadline_date }}{% endif %}
|
||||
From: {{ liaison.from_body }} ({{ liaison.person }} <{{ liaison.replyto|default:liaison.from_email|fix_ampersands }}>)
|
||||
To: {{ liaison.to_body }} ({{ liaison.to_poc }})
|
||||
Cc: {{ liaison.cc1 }}
|
||||
Reponse Contact: {{ liaison.response_contact }}
|
||||
Technical Contact: {{ liaison.technical_contact }}
|
||||
Purpose: {% if liaison.purpose_text %}{{ liaison.purpose_text }}{% else %}{{ liaison.purpose.purpose_text }}{% endif %}
|
||||
{% if liaison.related_to %}Referenced liaison: {% if liaison.related_to.title %}{{ liaison.related_to.title }}{% else %}Liaison #{{ liaison.related_to.pk }}{% endif %} ({% url liaison_detail object_id=liaison.related_to.pk %}){% endif %}
|
||||
Body: {{ liaison.body }}
|
||||
Attachment(s):
|
||||
{% for file in liaison.uploads_set.all %}
|
||||
{{ file.file_title }} https://datatracker.ietf.org/documents/LIAISON/file{{ file.file_id }}{{ file.file_extension }}
|
||||
{% empty %}
|
||||
No document has been attached
|
||||
{% endfor %}
|
|
@ -172,6 +172,38 @@
|
|||
}
|
||||
};
|
||||
|
||||
var checkPostOnly = function(post_only) {
|
||||
if (post_only) {
|
||||
$("input[name=send]").hide();
|
||||
} else {
|
||||
$("input[name=send]").show();
|
||||
}
|
||||
};
|
||||
|
||||
var updateReplyTo = function() {
|
||||
var select = form.find('select[name=from_fake_user]');
|
||||
var option = select.find('option:selected');
|
||||
reply.val(option.attr('title'));
|
||||
updateFrom();
|
||||
}
|
||||
|
||||
var userSelect = function(user_list) {
|
||||
if (!user_list || !user_list.length) {
|
||||
return;
|
||||
}
|
||||
var link = form.find('a.from_mailto');
|
||||
var select = form.find('select[name=from_fake_user]');
|
||||
var options = '';
|
||||
link.hide();
|
||||
$.each(user_list, function(index, person) {
|
||||
options += '<option value="' + person[0] + '" title="' + person[1][1] + '">'+ person[1][0] + ' <' + person[1][1] + '></option>';
|
||||
});
|
||||
select.remove();
|
||||
link.after('<select name="from_fake_user">' + options +'</select>')
|
||||
form.find('select[name=from_fake_user]').change(updateReplyTo);
|
||||
updateReplyTo();
|
||||
};
|
||||
|
||||
var updateInfo = function() {
|
||||
var entity = organization;
|
||||
var to_entity = from;
|
||||
|
@ -189,6 +221,8 @@
|
|||
render_mails_into(cc, response.cc);
|
||||
render_mails_into(poc, response.poc);
|
||||
toggleApproval(response.needs_approval);
|
||||
checkPostOnly(response.post_only);
|
||||
userSelect(response.full_list);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue