Files @ ba1df47d695b
Branch filter:

Location: symposion_app/symposion/reviews/utils.py

Patrick Altman
Remove templates

These have all been moved to the starter project,
pinax-project-symposion. The reasoning behind this is they are very
specific to the theme (pinax-theme-bootstrap) that the project uses and
not really all that reusable when packaged with this app.
def has_permission(user, proposal, speaker=False, reviewer=False):
    """
    Returns whether or not ther user has permission to review this proposal,
    with the specified requirements.

    If ``speaker`` is ``True`` then the user can be one of the speakers for the
    proposal.  If ``reviewer`` is ``True`` the speaker can be a part of the
    reviewer group.
    """
    if user.is_superuser:
        return True
    if speaker:
        if user == proposal.speaker.user or \
           proposal.additional_speakers.filter(user=user).exists():
            return True
    if reviewer:
        if user.groups.filter(name="reviewers").exists():
            return True
    return False