summaryrefslogtreecommitdiff
path: root/src/meetingtools/apps/auth/utils.py
blob: 3a7efe686cca13a5bb0977481ade87c9bfa6cbd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'''
Created on Jul 7, 2010

@author: leifj
'''
from uuid import uuid4

def nonce():
    return uuid4().hex

def anonid():
    return uuid4().urn

def groups(request):
    groups = []
    if request.user.is_authenticated():
        if request.session and request.session.has_key('entitlement'):
            groups = groups + request.session['entitlement']
        
        if '@' in request.user.username:
            (local,domain) = request.user.username.split('@')
            groups.append(domain)
            for e in ('member','employee','student'):
                groups.append("%s@%s" % (e,domain))

    return groups