on-demand release 2.1beta
[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
ea4e96c2
DC
132 'moodle_user_get_course_participants_by_id' => array(
133 'classname' => 'moodle_user_external',
134 'methodname' => 'get_course_participants_by_id',
135 'classpath' => 'user/externallib.php',
136 'description' => 'Get course user profiles by id.',
137 'type' => 'read',
138 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
139 ),
140
ef22c1b6 141 'moodle_user_delete_users' => array(
142 'classname' => 'moodle_user_external',
143 'methodname' => 'delete_users',
144 'classpath' => 'user/externallib.php',
fb79269b 145 'description' => 'Delete users.',
146 'type' => 'write',
72f68b51 147 'capabilities'=> 'moodle/user:delete',
ef22c1b6 148 ),
149
150 'moodle_user_update_users' => array(
151 'classname' => 'moodle_user_external',
152 'methodname' => 'update_users',
153 'classpath' => 'user/externallib.php',
fb79269b 154 'description' => 'Update users.',
155 'type' => 'write',
72f68b51 156 'capabilities'=> 'moodle/user:update',
ef22c1b6 157 ),
e9b66095 158
72f68b51 159 // === enrol related functions ===
160
df997f84
PS
161 'moodle_enrol_get_enrolled_users' => array(
162 'classname' => 'moodle_enrol_external',
163 'methodname' => 'get_enrolled_users',
164 'classpath' => 'enrol/externallib.php',
165 'description' => 'Get list of course participants',
166 'type' => 'read',
72f68b51 167 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
168 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
df997f84
PS
169 ),
170
3364dbb5
PS
171 'moodle_enrol_get_users_courses' => array(
172 'classname' => 'moodle_enrol_external',
173 'methodname' => 'get_users_courses',
174 'classpath' => 'enrol/externallib.php',
175 'description' => 'Get list of courses user is enrolled in',
176 'type' => 'read',
177 'capabilities'=> 'moodle/course:viewparticipants',
178 ),
179
df997f84 180 'moodle_role_assign' => array(
e9b66095 181 'classname' => 'moodle_enrol_external',
182 'methodname' => 'role_assign',
183 'classpath' => 'enrol/externallib.php',
df997f84 184 'description' => 'Manual role assignments.',
e9b66095 185 'type' => 'write',
72f68b51 186 'capabilities'=> 'moodle/role:assign',
e9b66095 187 ),
188
df997f84 189 'moodle_role_unassign' => array(
e9b66095 190 'classname' => 'moodle_enrol_external',
191 'methodname' => 'role_unassign',
192 'classpath' => 'enrol/externallib.php',
df997f84 193 'description' => 'Manual role unassignments.',
e9b66095 194 'type' => 'write',
72f68b51 195 'capabilities'=> 'moodle/role:assign',
e9b66095 196 ),
5b4a78e2 197
6bb31e40 198 // === course related functions ===
199
200 'moodle_course_get_courses' => array(
201 'classname' => 'moodle_course_external',
202 'methodname' => 'get_courses',
203 'classpath' => 'course/externallib.php',
204 'description' => 'Return course details',
205 'type' => 'read',
206 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
207 ),
208
209 'moodle_course_create_courses' => array(
210 'classname' => 'moodle_course_external',
211 'methodname' => 'create_courses',
212 'classpath' => 'course/externallib.php',
213 'description' => 'Create new courses',
214 'type' => 'write',
215 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
216 ),
217
a623b6b8
JM
218 // === message related functions ===
219
220 'moodle_message_send_messages' => array(
221 'classname' => 'moodle_message_external',
222 'methodname' => 'send_messages',
223 'classpath' => 'message/externallib.php',
224 'description' => 'Send messages',
225 'type' => 'write',
226 'capabilities'=> 'moodle/site:sendmessage',
227 ),
228
8d46dabb
JM
229 // === notes related functions ===
230
231 'moodle_notes_create_notes' => array(
232 'classname' => 'moodle_notes_external',
233 'methodname' => 'create_notes',
234 'classpath' => 'notes/externallib.php',
235 'description' => 'Create notes',
236 'type' => 'write',
237 'capabilities'=> 'moodle/notes:manage',
238 ),
239
0bf486a6
JM
240 // === webservice related functions ===
241
242 'moodle_webservice_get_siteinfo' => array(
243 'classname' => 'moodle_webservice_external',
244 'methodname' => 'get_siteinfo',
245 'classpath' => 'webservice/externallib.php',
246 'description' => 'Return some site info / user info / list web service functions',
247 'type' => 'read',
248 ),
249
9a0df45a 250);
c1b65883
JM
251
252$services = array(
96e0194c
SH
253 'Moodle mobile web service' => array(
254 'functions' => array (
255 'moodle_enrol_get_users_courses',
256 'moodle_enrol_get_enrolled_users',
f2806b9a
JM
257 'moodle_user_get_users_by_id',
258 'moodle_webservice_get_siteinfo',
259 'moodle_notes_create_notes',
ea4e96c2 260 'moodle_user_get_course_participants_by_id',
f2806b9a 261 'moodle_message_send_messages'),
96e0194c
SH
262 'enabled' => 0,
263 'restrictedusers' => 0,
264 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE
265 ),
266);