Changeset 59ed3da
- Timestamp:
- Apr 16, 2012, 11:36:22 PM (14 years ago)
- Branches:
- master, space-access, stable, stage
- Children:
- b38a26a
- Parents:
- bc7d506
- git-author:
- Alex Dehnert <adehnert@…> (04/16/12 23:36:22)
- git-committer:
- Alex Dehnert <adehnert@…> (04/16/12 23:36:22)
- Location:
- asadb
- Files:
-
- 2 edited
-
space/views.py (modified) (4 diffs)
-
template/space/manage-access.html (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
asadb/space/views.py
r2c86ed1 r59ed3da 44 44 def manage_access(request, pk, ): 45 45 group = get_object_or_404(groups.models.Group, pk=pk) 46 if not request.user.has_perm('groups.admin_group', group): 46 47 priv_view = request.user.has_perm('groups.view_group_private_info', group) 48 priv_admin = request.user.has_perm('groups.admin_group', group) 49 priv_rw = priv_admin 50 if not (priv_view or priv_admin): 47 51 raise PermissionDenied 52 48 53 office_access = group.officers(role='office-access') 49 54 locker_access = group.officers(role='locker-access') … … 52 57 locker_pairs = [] 53 58 changes = [] 54 extras_indices = range(6) 55 if request.method == 'POST': 59 if priv_rw: 60 extras_indices = range(6) 61 else: 62 extras_indices = [] 63 if request.method == 'POST' and priv_rw: 56 64 edited = True 57 65 else: … … 71 79 pair = (assignment, entries) 72 80 pairs.append(pair) 73 submit_button = (len(office_pairs) + len(locker_pairs)) > 081 allow_edit = priv_rw and ((len(office_pairs) + len(locker_pairs)) > 0) 74 82 context = { 75 83 'group': group, … … 79 87 'locker_pairs': locker_pairs, 80 88 'changes': changes, 81 ' submit_button': submit_button,89 'allow_edit': allow_edit, 82 90 'extras_indices': extras_indices, 83 91 'pagename':'group', -
asadb/template/space/manage-access.html
r96ef09f r59ed3da 50 50 <table class='pretty-table'> 51 51 <tr> 52 <th>Grant</th>52 {%if allow_edit%}<th>Grant</th>{%endif%} 53 53 <th>Name</th> 54 54 <th>MIT ID</th> … … 56 56 {% for entry in entries %} 57 57 <tr> 58 <td><input type='checkbox' name='grant[{{assignment.pk}}][{{entry.pk}}]' checked='checked'></td>58 {%if allow_edit%}<td><input type='checkbox' name='grant[{{assignment.pk}}][{{entry.pk}}]' checked='checked'></td>{% endif %} 59 59 <td>{{entry.name}}</td> 60 60 <td>{{entry.card_number}}</td> … … 110 110 {% endif %} 111 111 112 {% if submit_button%}112 {% if allow_edit %} 113 113 <input type='submit' name='submit' value='Update' /> 114 114 {% endif %}
Note: See TracChangeset
for help on using the changeset viewer.