1 from pybb.permissions import DefaultPermissionHandler
4 class ForumPermissionHandler(DefaultPermissionHandler):
5 def may_post_as_admin(self, user):
6 """ return True if `user` may post as admin """
9 def may_create_topic(self, user, forum):
10 """ return True if `user` is allowed to create a new topic in `forum` """
11 return user.is_authenticated()
13 def may_create_post(self, user, topic):
14 """ return True if `user` is allowed to create a new post in `topic` """
16 if topic.forum.hidden and (not user.is_staff):
17 # if topic is hidden, only staff may post
20 if topic.closed and (not user.is_staff):
21 # if topic is closed, only staff may post
24 return user.is_authenticated()