1 # -*- coding: utf-8 -*-
2 from pybb.permissions import DefaultPermissionHandler
5 class ForumPermissionHandler(DefaultPermissionHandler):
6 def may_post_as_admin(self, user):
7 """ return True if `user` may post as admin """
10 def may_create_topic(self, user, forum):
11 """ return True if `user` is allowed to create a new topic in `forum` """
12 return user.is_authenticated()
14 def may_create_post(self, user, topic):
15 """ return True if `user` is allowed to create a new post in `topic` """
17 if topic.forum.hidden and (not user.is_staff):
18 # if topic is hidden, only staff may post
21 if topic.closed and (not user.is_staff):
22 # if topic is closed, only staff may post
25 return user.is_authenticated()