def check_suggestion_permissions(request, mode, translation): """ Checks permission for suggestion handling. """ if mode in ('accept', 'accept_edit'): if not can_accept_suggestion(request.user, translation): messages.error( request, _('You do not have privilege to accept suggestions!') ) return False elif mode == 'delete': if not can_delete_suggestion(request.user, translation): messages.error( request, _('You do not have privilege to delete suggestions!') ) return False elif mode in ('upvode', 'downvote'): if not can_vote_suggestion(request.user, translation): messages.error( request, _('You do not have privilege to vote for suggestions!') ) return False return True
def check_suggestion_permissions(request, mode, translation): """ Checks permission for suggestion handling. """ if (translation.is_template() and not request.user.has_perm('trans.save_template')): # Need privilege to save messages.error( request, _('You don\'t have privileges to save templates!') ) return False if mode in ('accept', 'accept_edit'): if not can_accept_suggestion(request.user, translation): messages.error( request, _('You do not have privilege to accept suggestions!') ) return False elif mode == 'delete': if not can_delete_suggestion(request.user, translation): messages.error( request, _('You do not have privilege to delete suggestions!') ) return False elif mode in ('upvode', 'downvote'): if not can_vote_suggestion(request.user, translation): messages.error( request, _('You do not have privilege to vote for suggestions!') ) return False return True
def check_suggestion_permissions(request, mode, translation): """ Checks permission for suggestion handling. """ if mode in ("accept", "accept_edit"): if not can_accept_suggestion(request.user, translation): messages.error(request, _("You do not have privilege to accept suggestions!")) return False elif mode == "delete": if not can_delete_suggestion(request.user, translation): messages.error(request, _("You do not have privilege to delete suggestions!")) return False elif mode in ("upvode", "downvote"): if not can_vote_suggestion(request.user, translation): messages.error(request, _("You do not have privilege to vote for suggestions!")) return False return True