emergency release 2.2dev
[moodle.git] / lib / db / services.php
CommitLineData
9a0df45a 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 * Core external functions and service definitions.
20 *
5b4a78e2 21 * @package core
9a0df45a 22 * @subpackage webservice
23 * @copyright 2009 Petr Skoda (http://skodak.org)
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 */
26
27$functions = array(
ef22c1b6 28
29 // === group related functions ===
f5072177 30
9a0df45a 31 'moodle_group_create_groups' => array(
32 'classname' => 'moodle_group_external',
33 'methodname' => 'create_groups',
34 'classpath' => 'group/externallib.php',
f5072177 35 'description' => 'Creates new groups.',
36 'type' => 'write',
72f68b51 37 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 38 ),
f5072177 39
9a0df45a 40 'moodle_group_get_groups' => array(
41 'classname' => 'moodle_group_external',
42 'methodname' => 'get_groups',
43 'classpath' => 'group/externallib.php',
cfb99b75 44 'description' => 'Returns group details.',
f5072177 45 'type' => 'read',
72f68b51 46 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 47 ),
246f6da2 48
49 'moodle_group_get_course_groups' => array(
50 'classname' => 'moodle_group_external',
51 'methodname' => 'get_course_groups',
52 'classpath' => 'group/externallib.php',
53 'description' => 'Returns all groups in specified course.',
54 'type' => 'read',
72f68b51 55 'capabilities'=> 'moodle/course:managegroups',
246f6da2 56 ),
2cb1ee78 57
9a0df45a 58 'moodle_group_delete_groups' => array(
59 'classname' => 'moodle_group_external',
60 'methodname' => 'delete_groups',
61 'classpath' => 'group/externallib.php',
0f4e72de
PS
62 'description' => 'Deletes all specified groups.',
63 'type' => 'delete',
72f68b51 64 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 65 ),
c863dc38 66
9a0df45a 67 'moodle_group_get_groupmembers' => array(
68 'classname' => 'moodle_group_external',
69 'methodname' => 'get_groupmembers',
70 'classpath' => 'group/externallib.php',
0f4e72de
PS
71 'description' => 'Returns group members.',
72 'type' => 'read',
72f68b51 73 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 74 ),
4efa2483 75
9a0df45a 76 'moodle_group_add_groupmembers' => array(
77 'classname' => 'moodle_group_external',
78 'methodname' => 'add_groupmembers',
79 'classpath' => 'group/externallib.php',
0f4e72de
PS
80 'description' => 'Adds group members.',
81 'type' => 'write',
72f68b51 82 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 83 ),
84
85 'moodle_group_delete_groupmembers' => array(
86 'classname' => 'moodle_group_external',
87 'methodname' => 'delete_groupmembers',
88 'classpath' => 'group/externallib.php',
0f4e72de
PS
89 'description' => 'Deletes group members.',
90 'type' => 'delete',
72f68b51 91 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 92 ),
72f68b51 93
94
95 // === file related functions ===
96
249c4f60
DC
97 'moodle_file_get_files' => array(
98 'classname' => 'moodle_file_external',
99 'methodname' => 'get_files',
100 'description' => 'browse moodle files',
101 'type' => 'read',
102 'classpath' => 'files/externallib.php',
103 ),
104 'moodle_file_upload' => array(
105 'classname' => 'moodle_file_external',
106 'methodname' => 'upload',
107 'description' => 'upload a file to moodle',
108 'type' => 'write',
109 'classpath' => 'files/externallib.php',
110 ),
4efa2483 111
ef22c1b6 112 // === user related functions ===
72f68b51 113
ef22c1b6 114 'moodle_user_create_users' => array(
115 'classname' => 'moodle_user_external',
116 'methodname' => 'create_users',
117 'classpath' => 'user/externallib.php',
fb79269b 118 'description' => 'Create users.',
119 'type' => 'write',
72f68b51 120 'capabilities'=> 'moodle/user:create',
ef22c1b6 121 ),
122
fb79269b 123 'moodle_user_get_users_by_id' => array(
ef22c1b6 124 'classname' => 'moodle_user_external',
fb79269b 125 'methodname' => 'get_users_by_id',
ef22c1b6 126 'classpath' => 'user/externallib.php',
fb79269b 127 'description' => 'Get users by id.',
128 'type' => 'read',
b4c74367 129 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
ef22c1b6 130 ),
131
01479290
DC
132 'moodle_user_get_users_by_courseid' => array(
133 'classname' => 'moodle_user_external',
134 'methodname' => 'get_users_by_courseid',
135 'classpath' => 'user/externallib.php',
136 'description' => 'Get enrolled users by course id.',
137 'type' => 'read',
138 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
139 ),
140
ea4e96c2
DC
141 'moodle_user_get_course_participants_by_id' => array(
142 'classname' => 'moodle_user_external',
143 'methodname' => 'get_course_participants_by_id',
144 'classpath' => 'user/externallib.php',
145 'description' => 'Get course user profiles by id.',
146 'type' => 'read',
147 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
148 ),
149
ef22c1b6 150 'moodle_user_delete_users' => array(
151 'classname' => 'moodle_user_external',
152 'methodname' => 'delete_users',
153 'classpath' => 'user/externallib.php',
fb79269b 154 'description' => 'Delete users.',
155 'type' => 'write',
72f68b51 156 'capabilities'=> 'moodle/user:delete',
ef22c1b6 157 ),
158
159 'moodle_user_update_users' => array(
160 'classname' => 'moodle_user_external',
161 'methodname' => 'update_users',
162 'classpath' => 'user/externallib.php',
fb79269b 163 'description' => 'Update users.',
164 'type' => 'write',
72f68b51 165 'capabilities'=> 'moodle/user:update',
ef22c1b6 166 ),
e9b66095 167
72f68b51 168 // === enrol related functions ===
169
df997f84
PS
170 'moodle_enrol_get_enrolled_users' => array(
171 'classname' => 'moodle_enrol_external',
172 'methodname' => 'get_enrolled_users',
173 'classpath' => 'enrol/externallib.php',
174 'description' => 'Get list of course participants',
175 'type' => 'read',
72f68b51 176 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
177 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
df997f84
PS
178 ),
179
3364dbb5
PS
180 'moodle_enrol_get_users_courses' => array(
181 'classname' => 'moodle_enrol_external',
182 'methodname' => 'get_users_courses',
183 'classpath' => 'enrol/externallib.php',
184 'description' => 'Get list of courses user is enrolled in',
185 'type' => 'read',
186 'capabilities'=> 'moodle/course:viewparticipants',
187 ),
188
df997f84 189 'moodle_role_assign' => array(
e9b66095 190 'classname' => 'moodle_enrol_external',
191 'methodname' => 'role_assign',
192 'classpath' => 'enrol/externallib.php',
df997f84 193 'description' => 'Manual role assignments.',
e9b66095 194 'type' => 'write',
72f68b51 195 'capabilities'=> 'moodle/role:assign',
e9b66095 196 ),
197
df997f84 198 'moodle_role_unassign' => array(
e9b66095 199 'classname' => 'moodle_enrol_external',
200 'methodname' => 'role_unassign',
201 'classpath' => 'enrol/externallib.php',
df997f84 202 'description' => 'Manual role unassignments.',
e9b66095 203 'type' => 'write',
72f68b51 204 'capabilities'=> 'moodle/role:assign',
e9b66095 205 ),
5b4a78e2 206
6bb31e40 207 // === course related functions ===
208
209 'moodle_course_get_courses' => array(
210 'classname' => 'moodle_course_external',
211 'methodname' => 'get_courses',
212 'classpath' => 'course/externallib.php',
213 'description' => 'Return course details',
214 'type' => 'read',
215 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
216 ),
217
218 'moodle_course_create_courses' => array(
219 'classname' => 'moodle_course_external',
220 'methodname' => 'create_courses',
221 'classpath' => 'course/externallib.php',
222 'description' => 'Create new courses',
223 'type' => 'write',
224 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
225 ),
226
a623b6b8
JM
227 // === message related functions ===
228
4de00da7 229 'moodle_message_send_instantmessages' => array(
a623b6b8 230 'classname' => 'moodle_message_external',
4de00da7 231 'methodname' => 'send_instantmessages',
a623b6b8 232 'classpath' => 'message/externallib.php',
4de00da7 233 'description' => 'Send instant messages',
a623b6b8
JM
234 'type' => 'write',
235 'capabilities'=> 'moodle/site:sendmessage',
236 ),
237
8d46dabb
JM
238 // === notes related functions ===
239
240 'moodle_notes_create_notes' => array(
241 'classname' => 'moodle_notes_external',
242 'methodname' => 'create_notes',
243 'classpath' => 'notes/externallib.php',
244 'description' => 'Create notes',
245 'type' => 'write',
246 'capabilities'=> 'moodle/notes:manage',
247 ),
248
0bf486a6
JM
249 // === webservice related functions ===
250
251 'moodle_webservice_get_siteinfo' => array(
252 'classname' => 'moodle_webservice_external',
253 'methodname' => 'get_siteinfo',
254 'classpath' => 'webservice/externallib.php',
255 'description' => 'Return some site info / user info / list web service functions',
256 'type' => 'read',
257 ),
258
9a0df45a 259);
c1b65883
JM
260
261$services = array(
96e0194c
SH
262 'Moodle mobile web service' => array(
263 'functions' => array (
264 'moodle_enrol_get_users_courses',
265 'moodle_enrol_get_enrolled_users',
f2806b9a
JM
266 'moodle_user_get_users_by_id',
267 'moodle_webservice_get_siteinfo',
268 'moodle_notes_create_notes',
ea4e96c2 269 'moodle_user_get_course_participants_by_id',
01479290 270 'moodle_user_get_users_by_courseid',
4de00da7 271 'moodle_message_send_instantmessages'),
96e0194c
SH
272 'enabled' => 0,
273 'restrictedusers' => 0,
274 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE
275 ),
276);