Changeset 3655f02 for asadb/groups


Ignore:
Timestamp:
Aug 11, 2011, 2:34:18 AM (14 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage, test-hooks
Children:
70f2dd3
Parents:
b6d89f2
git-author:
Alex Dehnert <adehnert@…> (08/11/11 02:33:10)
git-committer:
Alex Dehnert <adehnert@…> (08/11/11 02:34:18)
Message:

Display the perms you have on the front page

Location:
asadb/groups
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • asadb/groups/models.py

    r2abe1dc r3655f02  
    6262            # permission that controls the admin interface
    6363            ('admin_group', 'Administer basic group information'),
     64            ('view_signatories', 'View signatory information for all groups'),
    6465        )
    6566
  • asadb/groups/views.py

    rc47b2e4 r3655f02  
    3131    users_groups = []
    3232    groupmsg = ""
     33    has_perms = []
    3334    if request.user.is_authenticated():
    3435        username = request.user.username
     
    3738        if len(users_groups) == 0:
    3839            groupmsg = "You do not currently appear to be listed with any groups."
     40
     41        perms = groups.models.Group._meta.permissions
     42        perms += (
     43            ('change_group', 'Change arbitrary group information', ),
     44        )
     45        for perm_name, perm_desc in perms:
     46            if request.user.has_perm('groups.%s' % (perm_name, )):
     47                has_perms.append((perm_name, perm_desc, ))
    3948    else:
    4049        groupmsg = "Log in to see the groups that you are listed with."
     
    4251        'groups': users_groups,
    4352        'groupmsg': groupmsg,
     53        'has_perms': has_perms,
    4454        'pagename': 'homepage',
    4555    }
Note: See TracChangeset for help on using the changeset viewer.