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