Browse Source

#728: threads permissions imports

Rafał Pitoń 8 years ago
parent
commit
391114d1fb

+ 1 - 1
misago/threads/api/pollvotecreateendpoint.py

@@ -8,7 +8,7 @@ from django.utils.translation import gettext as _
 from django.utils.translation import ungettext
 
 from misago.acl import add_acl
-from misago.threads.permissions.polls import allow_vote_poll
+from misago.threads.permissions import allow_vote_poll
 from misago.threads.serializers import PollSerializer
 
 

+ 1 - 1
misago/threads/api/postendpoints/merge.py

@@ -6,7 +6,7 @@ from django.utils.translation import ungettext
 
 from misago.acl import add_acl
 from misago.conf import settings
-from misago.threads.permissions.threads import exclude_invisible_posts
+from misago.threads.permissions import exclude_invisible_posts
 from misago.threads.serializers import PostSerializer
 
 

+ 1 - 1
misago/threads/api/postendpoints/move.py

@@ -7,7 +7,7 @@ from django.utils.translation import ugettext as _
 from django.utils.translation import ungettext
 
 from misago.conf import settings
-from misago.threads.permissions.threads import allow_move_post, exclude_invisible_posts
+from misago.threads.permissions import allow_move_post, exclude_invisible_posts
 from misago.threads.utils import get_thread_id_from_url
 
 

+ 1 - 1
misago/threads/api/postendpoints/patch_post.py

@@ -5,7 +5,7 @@ from misago.acl import add_acl
 from misago.core.apipatch import ApiPatch
 from misago.threads.models import PostLike
 from misago.threads.moderation import posts as moderation
-from misago.threads.permissions.threads import (
+from misago.threads.permissions import (
     allow_approve_post, allow_hide_post, allow_protect_post, allow_unhide_post)
 
 

+ 1 - 1
misago/threads/api/postendpoints/split.py

@@ -9,7 +9,7 @@ from misago.conf import settings
 from misago.threads.events import record_event
 from misago.threads.models import Thread
 from misago.threads.moderation import threads as moderation
-from misago.threads.permissions.threads import exclude_invisible_posts
+from misago.threads.permissions import exclude_invisible_posts
 from misago.threads.serializers import NewThreadSerializer
 
 

+ 1 - 1
misago/threads/api/postingendpoint/category.py

@@ -8,7 +8,7 @@ from misago.acl import add_acl
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories.models import Category
 from misago.categories.permissions import can_browse_category, can_see_category
-from misago.threads.permissions.threads import allow_start_thread
+from misago.threads.permissions import allow_start_thread
 from misago.threads.threadtypes import trees_map
 
 from . import PostingEndpoint, PostingMiddleware

+ 1 - 1
misago/threads/api/postingendpoint/emailnotification.py

@@ -1,7 +1,7 @@
 from django.utils.translation import ugettext as _
 
 from misago.core.mail import build_mail, send_messages
-from misago.threads.permissions.threads import can_see_post, can_see_thread
+from misago.threads.permissions import can_see_post, can_see_thread
 
 from . import PostingEndpoint, PostingMiddleware
 

+ 1 - 1
misago/threads/api/threadendpoints/editor.py

@@ -6,7 +6,7 @@ from django.utils.translation import gettext as _
 from misago.acl import add_acl
 from misago.categories import THREADS_ROOT_NAME
 from misago.categories.models import Category
-from misago.threads.permissions.threads import can_start_thread
+from misago.threads.permissions import can_start_thread
 from misago.threads.threadtypes import trees_map
 
 

+ 1 - 1
misago/threads/api/threadpoll.py

@@ -10,7 +10,7 @@ from django.utils.translation import gettext as _
 from misago.acl import add_acl
 from misago.core.shortcuts import get_int_or_404
 from misago.threads.models import Poll
-from misago.threads.permissions.polls import (
+from misago.threads.permissions import (
     allow_delete_poll, allow_edit_poll, allow_see_poll_votes, allow_start_poll, can_start_poll)
 from misago.threads.serializers import (
     EditPollSerializer, NewPollSerializer, PollSerializer, PollVoteSerializer)

+ 1 - 1
misago/threads/api/threadposts.py

@@ -10,7 +10,7 @@ from misago.acl import add_acl
 from misago.core.shortcuts import get_int_or_404
 from misago.threads.models import Post
 from misago.threads.moderation import posts as moderation
-from misago.threads.permissions.threads import (
+from misago.threads.permissions import (
     allow_delete_event, allow_delete_post, allow_edit_post, allow_reply_thread)
 from misago.threads.serializers import AttachmentSerializer, PostSerializer
 from misago.threads.viewmodels import ForumThread, PrivateThread, ThreadPost, ThreadPosts

+ 1 - 1
misago/threads/permissions/__init__.py

@@ -1,3 +1,3 @@
-# flake8: noqa
 from .privatethreads import *
 from .threads import *
+from .polls import *

+ 14 - 0
misago/threads/permissions/polls.py

@@ -11,6 +11,20 @@ from misago.core.forms import YesNoSwitch
 from misago.threads.models import Poll, Thread
 
 
+__all__ = [
+    'allow_start_poll',
+    'can_start_poll',
+    'allow_edit_poll',
+    'can_edit_poll',
+    'allow_delete_poll',
+    'can_delete_poll',
+    'allow_vote_poll',
+    'can_vote_poll',
+    'allow_see_poll_votes',
+    'can_see_poll_votes',
+]
+
+
 """
 Admin Permissions Forms
 """

+ 18 - 0
misago/threads/permissions/privatethreads.py

@@ -14,6 +14,24 @@ from misago.core.forms import YesNoSwitch
 from misago.threads.models import Thread
 
 
+__all__ = [
+    'allow_use_private_threads',
+    'can_use_private_threads',
+    'allow_see_private_thread',
+    'can_see_private_thread',
+    'allow_change_owner',
+    'can_change_owner',
+    'allow_add_participants',
+    'can_add_participants',
+    'allow_remove_participant',
+    'can_remove_participant',
+    'allow_add_participant',
+    'can_add_participant',
+    'allow_message_user',
+    'can_message_user',
+]
+
+
 """
 Admin Permissions Form
 """

+ 32 - 0
misago/threads/permissions/threads.py

@@ -15,6 +15,38 @@ from misago.core.forms import YesNoSwitch
 from misago.threads.models import Post, Thread
 
 
+__all__ = [
+    'allow_see_thread',
+    'can_see_thread',
+    'allow_start_thread',
+    'can_start_thread',
+    'allow_reply_thread',
+    'can_reply_thread',
+    'allow_edit_thread',
+    'can_edit_thread',
+    'allow_see_post',
+    'can_see_post',
+    'allow_edit_post',
+    'can_edit_post',
+    'allow_unhide_post',
+    'can_unhide_post',
+    'allow_hide_post',
+    'can_hide_post',
+    'allow_delete_post',
+    'can_delete_post',
+    'allow_protect_post',
+    'can_protect_post',
+    'allow_approve_post',
+    'can_approve_post',
+    'allow_move_post',
+    'can_move_post',
+    'allow_delete_event',
+    'can_delete_event',
+    'exclude_invisible_threads',
+    'exclude_invisible_posts',
+]
+
+
 """
 Admin Permissions Forms
 """

+ 1 - 1
misago/threads/viewmodels/post.py

@@ -2,7 +2,7 @@ from django.shortcuts import get_object_or_404
 
 from misago.acl import add_acl
 from misago.core.viewmodel import ViewModel as BaseViewModel
-from misago.threads.permissions.threads import exclude_invisible_posts
+from misago.threads.permissions import exclude_invisible_posts
 
 
 __all__ = ['ThreadPost']

+ 1 - 1
misago/threads/viewmodels/posts.py

@@ -3,7 +3,7 @@ from misago.conf import settings
 from misago.core.shortcuts import paginate, pagination_dict
 from misago.readtracker.threadstracker import make_posts_read_aware
 from misago.threads.paginator import PostsPaginator
-from misago.threads.permissions.threads import exclude_invisible_posts
+from misago.threads.permissions import exclude_invisible_posts
 from misago.threads.serializers import PostSerializer
 from misago.threads.utils import add_likes_to_posts
 from misago.users.online.utils import make_users_status_aware

+ 2 - 3
misago/threads/viewmodels/thread.py

@@ -9,9 +9,8 @@ from misago.core.viewmodel import ViewModel as BaseViewModel
 from misago.readtracker.threadstracker import make_read_aware
 from misago.threads.models import Poll, Thread
 from misago.threads.participants import make_participants_aware
-from misago.threads.permissions.privatethreads import (
-    allow_see_private_thread, allow_use_private_threads)
-from misago.threads.permissions.threads import allow_see_thread
+from misago.threads.permissions import (
+    allow_see_private_thread, allow_see_thread, allow_use_private_threads)
 from misago.threads.serializers import PrivateThreadSerializer, ThreadSerializer
 from misago.threads.subscriptions import make_subscription_aware
 from misago.threads.threadtypes import trees_map

+ 1 - 1
misago/threads/views/goto.py

@@ -6,7 +6,7 @@ from django.utils.translation import ugettext as _
 from django.views.generic import View
 
 from misago.conf import settings
-from misago.threads.permissions.threads import exclude_invisible_posts
+from misago.threads.permissions import exclude_invisible_posts
 from misago.threads.viewmodels import ForumThread, PrivateThread