Forum permission¶
The forum_permission
application provides the proper tools to allow permission checks on forums. It defines permission abstract models and provides
Abstract models¶
-
class
machina.apps.forum_permission.abstract_models.
AbstractForumPermission
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Represents a single forum permission.
-
class
machina.apps.forum_permission.abstract_models.
AbstractGroupForumPermission
(*args, **kwargs)¶ Bases:
machina.apps.forum_permission.abstract_models.BaseAuthForumPermission
Represents a per-group forum object permission.
-
class
machina.apps.forum_permission.abstract_models.
AbstractUserForumPermission
(*args, **kwargs)¶ Bases:
machina.apps.forum_permission.abstract_models.BaseAuthForumPermission
Represents a per-user forum object permission.
-
class
machina.apps.forum_permission.abstract_models.
BaseAuthForumPermission
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Represents a per-auth-component forum object permission.
Checker¶
-
class
machina.apps.forum_permission.checker.
ForumPermissionChecker
(user)¶ Bases:
object
The ForumPermissionChecker allows to check forum permissions on Forum instances.
-
get_perms
(forum)¶ Returns the list of permission codenames of all permissions for the given forum.
-
has_perm
(perm, forum)¶ Checks if the considered user has given permission for the passed forum.
-
Handler¶
-
class
machina.apps.forum_permission.handler.
PermissionHandler
¶ Bases:
object
The PermissionHandler allows to filter lists of forums and to perform permission verifications on forums. It uses the ForumPermissionChecker class to perform these verifications.
-
can_access_moderation_queue
(user)¶ Returns True if the passed user can access the moderation queue. The latest allows the moderator to approve posts.
-
can_add_announcements
(forum, user)¶ Given a forum, checks whether the user can append announcements to it.
-
can_add_post
(topic, user)¶ Given a topic, checks whether the user can append posts to it.
-
can_add_stickies
(forum, user)¶ Given a forum, checks whether the user can append stickies to it.
-
can_add_topic
(forum, user)¶ Given a forum, checks whether the user can append topics to it.
-
can_approve_posts
(forum, user)¶ Given a forum, checks whether the user can approve its posts.
-
can_attach_files
(forum, user)¶ Given a forum, checks whether the user can add attachments to posts.
-
can_create_polls
(forum, user)¶ Given a forum, checks whether the user can add a topic with an embedded poll.
-
can_delete_post
(post, user)¶ Given a forum post, checks whether the user can delete the latter.
-
can_delete_topics
(forum, user)¶ Given a forum, checks whether the user can delete its topics. Note: the
can_delete_posts
permission is used here because a user who can delete all the posts of a topic is also able to delete the topic itself.
-
can_download_files
(forum, user)¶ Given a forum, checks whether the user can download files attached to posts.
-
can_edit_post
(post, user)¶ Given a forum post, checks whether the user can edit the latter.
-
can_lock_topics
(forum, user)¶ Given a forum, checks whether the user can lock its topics.
-
can_move_topics
(forum, user)¶ Given a forum, checks whether the user can move its topics to another forum.
-
can_post_without_approval
(forum, user)¶ Given a forum, checks whether the user can add a posts and topics without approval.
-
can_read_forum
(forum, user)¶ Given a forum, checks whether the user can read its content.
-
can_subscribe_to_topic
(topic, user)¶ Given a topic, checks whether the user can add it to his subscription list.
-
can_unsubscribe_from_topic
(topic, user)¶ Given a topic, checks whether the user can remove it from his subscription list.
-
can_update_topics_to_announces
(forum, user)¶ Given a forum, checks whether the user can change its topic types to announces.
-
can_update_topics_to_normal_topics
(forum, user)¶ Given a forum, checks whether the user can change its topic types to normal topics.
-
can_update_topics_to_sticky_topics
(forum, user)¶ Given a forum, checks whether the user can change its topic types to sticky topics.
-
can_vote_in_poll
(poll, user)¶ Given a poll, checks whether the user can answer to it.
-
forum_list_filter
(qs, user)¶ Filters the given queryset in order to return a list of forums that can be seen or read by the specified user (at least).
-
get_forum_last_post
(forum, user)¶ Given a forum, fetch the last post that can be read by the passed user.
-
get_moderation_queue_forums
(user)¶ Returns the list of forums whose posts can be approved by the considered user.
-
get_target_forums_for_moved_topics
(user)¶ Returns a list of forums in which the considered user can add topics that have been moved from another forum.
-