MDL-52165 mod_forum: New Web Service mod_forum_can_add_discussion
[moodle.git] / mod / forum / db / services.php
CommitLineData
2b9fe87d
MN
1<?php
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18/**
19 * Forum external functions and service definitions.
20 *
21 * @package mod_forum
22 * @copyright 2012 Mark Nelson <markn@moodle.com>
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 */
25
26$functions = array(
27
28 'mod_forum_get_forums_by_courses' => array(
29 'classname' => 'mod_forum_external',
30 'methodname' => 'get_forums_by_courses',
31 'classpath' => 'mod/forum/externallib.php',
32 'description' => 'Returns a list of forum instances in a provided set of courses, if
33 no courses are provided then all the forum instances the user has access to will be
34 returned.',
35 'type' => 'read',
36 'capabilities' => 'mod/forum:viewdiscussion'
a9a0cb69
MN
37 ),
38
39 'mod_forum_get_forum_discussions' => array(
40 'classname' => 'mod_forum_external',
41 'methodname' => 'get_forum_discussions',
42 'classpath' => 'mod/forum/externallib.php',
b235aef0
JL
43 'description' => 'DEPRECATED (use mod_forum_get_forum_discussions_paginated instead):
44 Returns a list of forum discussions contained within a given set of forums.',
a9a0cb69
MN
45 'type' => 'read',
46 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting'
e2ede426
JL
47 ),
48
49 'mod_forum_get_forum_discussion_posts' => array(
50 'classname' => 'mod_forum_external',
51 'methodname' => 'get_forum_discussion_posts',
52 'classpath' => 'mod/forum/externallib.php',
53 'description' => 'Returns a list of forum posts for a discussion.',
54 'type' => 'read',
55 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting'
2ce8934b
JL
56 ),
57
58 'mod_forum_get_forum_discussions_paginated' => array(
59 'classname' => 'mod_forum_external',
60 'methodname' => 'get_forum_discussions_paginated',
61 'classpath' => 'mod/forum/externallib.php',
62 'description' => 'Returns a list of forum discussions optionally sorted and paginated.',
63 'type' => 'read',
64 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting'
65 ),
449a6304
JL
66
67 'mod_forum_view_forum' => array(
68 'classname' => 'mod_forum_external',
69 'methodname' => 'view_forum',
70 'classpath' => 'mod/forum/externallib.php',
1c2b7882 71 'description' => 'Trigger the course module viewed event and update the module completion status.',
449a6304
JL
72 'type' => 'write',
73 'capabilities' => 'mod/forum:viewdiscussion'
74 ),
d508dfe7
JL
75
76 'mod_forum_view_forum_discussion' => array(
77 'classname' => 'mod_forum_external',
78 'methodname' => 'view_forum_discussion',
79 'classpath' => 'mod/forum/externallib.php',
1c2b7882 80 'description' => 'Trigger the forum discussion viewed event.',
d508dfe7
JL
81 'type' => 'write',
82 'capabilities' => 'mod/forum:viewdiscussion'
83 ),
50a20317
JL
84
85 'mod_forum_add_discussion_post' => array(
86 'classname' => 'mod_forum_external',
87 'methodname' => 'add_discussion_post',
88 'classpath' => 'mod/forum/externallib.php',
89 'description' => 'Create new posts into an existing discussion.',
90 'type' => 'write',
91 'capabilities' => 'mod/forum:replypost'
92 ),
7ab43ac8
JL
93
94 'mod_forum_add_discussion' => array(
95 'classname' => 'mod_forum_external',
96 'methodname' => 'add_discussion',
97 'classpath' => 'mod/forum/externallib.php',
98 'description' => 'Add a new discussion into an existing forum.',
99 'type' => 'write',
100 'capabilities' => 'mod/forum:startdiscussion'
101 ),
04cd8ae3
JL
102
103 'mod_forum_can_add_discussion' => array(
104 'classname' => 'mod_forum_external',
105 'methodname' => 'can_add_discussion',
106 'classpath' => 'mod/forum/externallib.php',
107 'description' => 'Check if the current user can add discussions in the given forum (and optionally for the given group).',
108 'type' => 'read'
109 ),
2b9fe87d 110);