Source

Ochs / staff / util.py

Full commit
def check_role(user, roles):
    if user.is_superuser:
        return True
    if user.is_anonymous:
        return False
    user_perms = set([p.position for p in user.position.all().order_by('position')])
    allowed_perms = set(roles)
    print "allowed_perms ", allowed_perms
    print "user_perms ", user_perms
    for perm in user_perms:
        if perm in allowed_perms:
            return True
    return False