Ejemplo n.º 1
0
    def check_forum_permissions(self, request, forum):
        if forum.special_role:
            raise Http404()

        add_acl(request.user, forum)
        allow_see_forum(request.user, forum)
        allow_browse_forum(request.user, forum)
Ejemplo n.º 2
0
    def check_forum_permissions(self, request, forum):
        if forum.special_role:
            raise Http404()

        add_acl(request.user, forum)
        allow_see_forum(request.user, forum)
        allow_browse_forum(request.user, forum)
Ejemplo n.º 3
0
    def clean(self):
        data = super(MovePostsForm, self).clean()

        new_thread_url = data.get('new_thread_url')
        try:
            if not new_thread_url:
                raise Http404()

            resolution = resolve(urlparse(new_thread_url).path)
            if not 'thread_id' in resolution.kwargs:
                raise Http404()

            queryset = Thread.objects.select_related('forum')
            self.new_thread = queryset.get(id=resolution.kwargs['thread_id'])

            add_acl(self.user, self.new_thread.forum)
            add_acl(self.user, self.new_thread)

            allow_see_forum(self.user, self.new_thread.forum)
            allow_browse_forum(self.user, self.new_thread.forum)
            allow_see_thread(self.user, self.new_thread)

        except (Http404, Thread.DoesNotExist):
            message = _("You have to enter valid link to thread.")
            raise forms.ValidationError(message)

        if self.thread == self.new_thread:
            message = _("New thread is same as current one.")
            raise forms.ValidationError(message)

        if self.new_thread.forum.special_role:
            message = _("You can't move posts to special threads.")
            raise forms.ValidationError(message)

        return data
Ejemplo n.º 4
0
def category(request, forum):
    allow_browse_forum(request.user, forum)
    if forum.level == 1:
        return dj_redirect(forum.get_absolute_url())
    forums = get_forums_list(request.user, forum)

    return render(request, 'misago/forums/category.html', {
        'category': forum,
        'forums': forums,
        'path': get_forum_path(forum),
    })
Ejemplo n.º 5
0
 def check_forum_permissions(self, request, forum):
     add_acl(request.user, forum)
     allow_see_forum(request.user, forum)
     allow_browse_forum(request.user, forum)
Ejemplo n.º 6
0
 def check_forum_permissions(self, request, forum):
     add_acl(request.user, forum)
     allow_see_forum(request.user, forum)
     allow_browse_forum(request.user, forum)