Changeset 7dde669 for asadb/groups


Ignore:
Timestamp:
Nov 30, 2013, 9:51:49 PM (12 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, stable, stage
Children:
aed3e6d
Parents:
00ec3e4
git-author:
Alex Dehnert <adehnert@…> (11/30/13 16:36:14)
git-committer:
Alex Dehnert <adehnert@…> (11/30/13 21:51:49)
Message:

Add pre-group-approval warnings

This fixes (enough, at least for now) several issues by adding warnings
to the approval page when certain constraints are violated:

  • ASA-#216: New group "ERROR:" emails should get suppressed earlier
  • ASA-#234: max locker name length
  • ASA-#246: Add reminders of common issues to the new group confirmation page
File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/groups/views.py

    r89165c1 r7dde669  
    696696            from_email='asa-admin@mit.edu',
    697697        )
    698         # XXX: Handle this better
    699         if officer_domain != 'mit.edu' or (create_group_list and group_domain != 'mit.edu'):
    700             accounts_mail.to = ['asa-groups@mit.edu']
    701             accounts_mail.cc = ['asa-db@mit.edu']
    702             accounts_mail.subject = "ERROR: " + accounts_mail.subject
    703             accounts_mail.body = "Bad domain on officer or group list\n\n" + accounts_mail.body
    704698
    705699    else:
     
    828822    return render_to_response('groups/create/startup.html', context, context_instance=RequestContext(request), )
    829823
     824def review_group_check_warnings(group_startup, group, ):
     825    warnings = []
     826
     827    if group.name.startswith("MIT "):
     828        warnings.append('Group name starts with "MIT". Generally, we prefer "Foo, MIT" instead.')
     829    if "mit" in group.athena_locker.lower():
     830        warnings.append('Athena locker name contains "mit", which may be redundant with paths like "http://web.mit.edu/mitfoo" or "/mit/foo/".')
     831
     832    if group_startup.president_kerberos == group_startup.treasurer_kerberos:
     833        warnings.append('President matches Treasurer.')
     834    if "%s@mit.edu" % (group_startup.president_kerberos, ) in (group.officer_email, group.group_email):
     835        warnings.append('President email matches officer and/or group email.')
     836    if group.officer_email == group.group_email:
     837        warnings.append('Officer email matches group email.')
     838
     839    if '@mit.edu' not in group.officer_email or '@mit.edu' not in group.group_email:
     840        warnings.append('Officer and/or group email are non-MIT. Ensure that they are not requesting the addresses be created, and consider suggesting they use an MIT list instead.')
     841
     842    if '.' in group.athena_locker:
     843        warnings.append('Athena locker contains a ".". This is not compatible with scripts.mit.edu\'s wildcard certificate, and may cause other problems.')
     844    if '_' in group.athena_locker:
     845        warnings.append('Athena locker contains a "_". If this locker name gets used in a URL (for example, locker.scripts.mit.edu), it will technically violate the hostname specification and may not work in some clients.')
     846    if len(group.athena_locker) > 12:
     847        warnings.append('Athena locker is more than twelve characters long. In general, twelve characters is the longest Athena locker an ASA-recognized group can get.')
     848
     849    return warnings
     850
    830851@permission_required('groups.recognize_group')
    831852def recognize_normal_group(request, pk, ):
     
    843864    if group_startup.stage != groups.models.GROUP_STARTUP_STAGE_SUBMITTED:
    844865        return render_to_response('groups/create/err.not-applying.html', context, context_instance=RequestContext(request), )
     866
     867    context['warnings'] = review_group_check_warnings(group_startup, group)
    845868
    846869    context['msg'] = ""
Note: See TracChangeset for help on using the changeset viewer.