Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Capability manager for the forum. More...
Public Member Functions | |
__construct (forum_entity $forum, legacy_forum_data_mapper $forumdatamapper, legacy_discussion_data_mapper $discussiondatamapper, legacy_post_data_mapper $postdatamapper) | |
Constructor. More... | |
can_access_all_groups (stdClass $user) | |
Can the user access all groups? More... | |
can_access_group (stdClass $user, int $groupid) | |
Can the user access the given group? More... | |
can_create_discussions (stdClass $user, int $groupid=null) | |
Can the user create discussions in this forum? More... | |
can_delete_post (stdClass $user, discussion_entity $discussion, post_entity $post, bool $hasreplies=false) | |
Can the user delete the post in this discussion? More... | |
can_edit_post (stdClass $user, discussion_entity $discussion, post_entity $post) | |
Can the user edit the post in this discussion? More... | |
can_export_discussions (stdClass $user) | |
Can the user export (see portfolios) discussions in this forum? More... | |
can_export_forum (stdClass $user) | |
Checks whether the user can export the whole forum (discussions and posts). More... | |
can_export_post (stdClass $user, post_entity $post) | |
Can the user export (see portfolios) the post in this discussion? More... | |
can_favourite_discussion (stdClass $user) | |
Can the user favourite the discussion. More... | |
can_grade (stdClass $grader, stdClass $gradee=null) | |
Check whether the supplied grader can grade the gradee. More... | |
can_manage_forum (stdClass $user) | |
Can the user manage this forum? More... | |
can_manage_tags (stdClass $user) | |
Can the user manage tags on the site? More... | |
can_manually_control_post_read_status (stdClass $user) | |
Can the user manually mark posts as read/unread in this forum? More... | |
can_move_discussion (stdClass $user, discussion_entity $discussion) | |
Can the user move the discussion in this forum? More... | |
can_move_discussions (stdClass $user) | |
Can the user move discussions in this forum? More... | |
can_pin_discussion (stdClass $user, discussion_entity $discussion) | |
Is the user pin the discussion? More... | |
can_pin_discussions (stdClass $user) | |
Can the user pin discussions in this forum? More... | |
can_post_in_discussion (stdClass $user, discussion_entity $discussion) | |
Can the user post in this discussion? More... | |
can_post_to_my_groups (stdClass $user) | |
Can the user post to their groups? More... | |
can_reply_privately_to_post (stdClass $user, post_entity $post) | |
Can the user reply privately to the specified post? More... | |
can_reply_to_post (stdClass $user, discussion_entity $discussion, post_entity $post) | |
Can the user reply to the post in this discussion? More... | |
can_self_enrol (stdClass $user) | |
Checks whether the user can self enrol into the course. More... | |
can_split_discussions (stdClass $user) | |
Can the user split discussions in this forum? More... | |
can_split_post (stdClass $user, discussion_entity $discussion, post_entity $post) | |
Can the user split the post in this discussion? More... | |
can_subscribe_to_discussion (stdClass $user, discussion_entity $discussion) | |
Can the user subscribe to the give discussion? More... | |
can_subscribe_to_forum (stdClass $user) | |
Can the user subscribe to this forum? More... | |
can_view_any_private_reply (stdClass $user) | |
Whether the user can view any private reply in the forum. More... | |
can_view_discussion (stdClass $user, discussion_entity $discussion) | |
Can the user view the content of a discussion? More... | |
can_view_discussions (stdClass $user) | |
Can the user view discussions in this forum? More... | |
can_view_hidden_posts (stdClass $user) | |
Can the user view hidden posts in this forum? More... | |
can_view_participants (stdClass $user, discussion_entity $discussion) | |
Can the user view the participants of this discussion? More... | |
can_view_post (stdClass $user, discussion_entity $discussion, post_entity $post) | |
Can the user view the content of the post in this discussion? More... | |
can_view_post_shell (stdClass $user, post_entity $post) | |
Can the user view the post at all? In some situations the user can view the shell of a post without being able to view its content. More... | |
must_post_before_viewing_discussion (stdClass $user, discussion_entity $discussion) | |
Is the user required to post in the discussion before they can view it? More... | |
validate_delete_post (stdClass $user, discussion_entity $discussion, post_entity $post, bool $hasreplies=false) | |
Verifies is the given user can delete a post. More... | |
Protected Member Functions | |
get_context () | |
Get the context for this capability manager. More... | |
get_discussion_record (discussion_entity $discussion) | |
Get the legacy discussion record for the given discussion entity. More... | |
get_forum () | |
Get the forum entity for this capability manager. More... | |
get_forum_record () | |
Get the legacy forum record for this forum. More... | |
get_post_record (post_entity $post) | |
Get the legacy post record for the given post entity. More... | |
Protected Attributes | |
array | $canviewpostcache = [] |
$canviewpostcache Cache of discussion posts that can be viewed by a user. | |
Capability manager for the forum.
Defines all the business rules for what a user can and can't do in the forum.
mod_forum\local\managers\capability::__construct | ( | forum_entity | $forum, |
legacy_forum_data_mapper | $forumdatamapper, | ||
legacy_discussion_data_mapper | $discussiondatamapper, | ||
legacy_post_data_mapper | $postdatamapper | ||
) |
Constructor.
forum_entity | $forum | The forum entity to manage capabilities for. |
legacy_forum_data_mapper | $forumdatamapper | Legacy forum data mapper |
legacy_discussion_data_mapper | $discussiondatamapper | Legacy discussion data mapper |
legacy_post_data_mapper | $postdatamapper | Legacy post data mapper |
mod_forum\local\managers\capability::can_access_all_groups | ( | stdClass | $user | ) |
Can the user access all groups?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_access_group | ( | stdClass | $user, |
int | $groupid | ||
) |
Can the user access the given group?
stdClass | $user | The user to check |
int | $groupid | The id of the group that the forum is set to |
bool |
mod_forum\local\managers\capability::can_create_discussions | ( | stdClass | $user, |
int | $groupid = null |
||
) |
Can the user create discussions in this forum?
stdClass | $user | The user to check |
int | null | $groupid | The current activity group id |
bool |
mod_forum\local\managers\capability::can_delete_post | ( | stdClass | $user, |
discussion_entity | $discussion, | ||
post_entity | $post, | ||
bool | $hasreplies = false |
||
) |
Can the user delete the post in this discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
post_entity | $post | The post the user wants to delete |
bool | $hasreplies | Whether the post has replies |
bool |
mod_forum\local\managers\capability::can_edit_post | ( | stdClass | $user, |
discussion_entity | $discussion, | ||
post_entity | $post | ||
) |
Can the user edit the post in this discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
post_entity | $post | The post the user wants to edit |
bool |
mod_forum\local\managers\capability::can_export_discussions | ( | stdClass | $user | ) |
Can the user export (see portfolios) discussions in this forum?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_export_forum | ( | stdClass | $user | ) |
Checks whether the user can export the whole forum (discussions and posts).
stdClass | $user | The user object. |
bool | True if the user can export the forum or false otherwise. |
mod_forum\local\managers\capability::can_export_post | ( | stdClass | $user, |
post_entity | $post | ||
) |
Can the user export (see portfolios) the post in this discussion?
stdClass | $user | The user to check |
post_entity | $post | The post the user wants to export |
bool |
mod_forum\local\managers\capability::can_favourite_discussion | ( | stdClass | $user | ) |
Can the user favourite the discussion.
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_grade | ( | stdClass | $grader, |
stdClass | $gradee = null |
||
) |
Check whether the supplied grader can grade the gradee.
stdClass | $grader | The user grading |
stdClass | $gradee | The user being graded |
bool |
mod_forum\local\managers\capability::can_manage_forum | ( | stdClass | $user | ) |
Can the user manage this forum?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_manage_tags | ( | stdClass | $user | ) |
Can the user manage tags on the site?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_manually_control_post_read_status | ( | stdClass | $user | ) |
Can the user manually mark posts as read/unread in this forum?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_move_discussion | ( | stdClass | $user, |
discussion_entity | $discussion | ||
) |
Can the user move the discussion in this forum?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
bool |
mod_forum\local\managers\capability::can_move_discussions | ( | stdClass | $user | ) |
Can the user move discussions in this forum?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_pin_discussion | ( | stdClass | $user, |
discussion_entity | $discussion | ||
) |
Is the user pin the discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
bool |
mod_forum\local\managers\capability::can_pin_discussions | ( | stdClass | $user | ) |
Can the user pin discussions in this forum?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_post_in_discussion | ( | stdClass | $user, |
discussion_entity | $discussion | ||
) |
Can the user post in this discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
bool |
mod_forum\local\managers\capability::can_post_to_my_groups | ( | stdClass | $user | ) |
Can the user post to their groups?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_reply_privately_to_post | ( | stdClass | $user, |
post_entity | $post | ||
) |
Can the user reply privately to the specified post?
stdClass | $user | The user to check |
post_entity | $post | The post the user wants to reply to |
bool |
mod_forum\local\managers\capability::can_reply_to_post | ( | stdClass | $user, |
discussion_entity | $discussion, | ||
post_entity | $post | ||
) |
Can the user reply to the post in this discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
post_entity | $post | The post the user wants to reply to |
bool |
mod_forum\local\managers\capability::can_self_enrol | ( | stdClass | $user | ) |
Checks whether the user can self enrol into the course.
Mimics the checks on the add button in deprecatedlib/forum_print_latest_discussions
stdClass | $user |
bool |
mod_forum\local\managers\capability::can_split_discussions | ( | stdClass | $user | ) |
Can the user split discussions in this forum?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_split_post | ( | stdClass | $user, |
discussion_entity | $discussion, | ||
post_entity | $post | ||
) |
Can the user split the post in this discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
post_entity | $post | The post the user wants to split |
bool |
mod_forum\local\managers\capability::can_subscribe_to_discussion | ( | stdClass | $user, |
discussion_entity | $discussion | ||
) |
Can the user subscribe to the give discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
bool |
mod_forum\local\managers\capability::can_subscribe_to_forum | ( | stdClass | $user | ) |
Can the user subscribe to this forum?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_view_any_private_reply | ( | stdClass | $user | ) |
Whether the user can view any private reply in the forum.
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_view_discussion | ( | stdClass | $user, |
discussion_entity | $discussion | ||
) |
Can the user view the content of a discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
bool |
mod_forum\local\managers\capability::can_view_discussions | ( | stdClass | $user | ) |
Can the user view discussions in this forum?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_view_hidden_posts | ( | stdClass | $user | ) |
Can the user view hidden posts in this forum?
stdClass | $user | The user to check |
bool |
mod_forum\local\managers\capability::can_view_participants | ( | stdClass | $user, |
discussion_entity | $discussion | ||
) |
Can the user view the participants of this discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
bool |
mod_forum\local\managers\capability::can_view_post | ( | stdClass | $user, |
discussion_entity | $discussion, | ||
post_entity | $post | ||
) |
Can the user view the content of the post in this discussion?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
post_entity | $post | The post the user wants to view |
bool |
mod_forum\local\managers\capability::can_view_post_shell | ( | stdClass | $user, |
post_entity | $post | ||
) |
Can the user view the post at all? In some situations the user can view the shell of a post without being able to view its content.
stdClass | $user | The user to check |
post_entity | $post | The post the user wants to view |
bool |
|
protected |
Get the context for this capability manager.
context |
|
protected |
Get the legacy discussion record for the given discussion entity.
discussion_entity | $discussion | The discussion to convert |
stdClass |
|
protected |
Get the forum entity for this capability manager.
forum_entity |
|
protected |
Get the legacy forum record for this forum.
stdClass |
|
protected |
Get the legacy post record for the given post entity.
post_entity | $post | The post to convert |
stdClass |
mod_forum\local\managers\capability::must_post_before_viewing_discussion | ( | stdClass | $user, |
discussion_entity | $discussion | ||
) |
Is the user required to post in the discussion before they can view it?
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
bool |
mod_forum\local\managers\capability::validate_delete_post | ( | stdClass | $user, |
discussion_entity | $discussion, | ||
post_entity | $post, | ||
bool | $hasreplies = false |
||
) |
Verifies is the given user can delete a post.
stdClass | $user | The user to check |
discussion_entity | $discussion | The discussion to check |
post_entity | $post | The post the user wants to delete |
bool | $hasreplies | Whether the post has replies |
bool |
moodle_exception |