File: jsonrpc.php.doc

package info (click to toggle)
fusiondirectory 1.0.19-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 32,060 kB
  • sloc: php: 47,469; pascal: 2,993; perl: 2,431; xml: 1,822; sh: 136; makefile: 19
file content (287 lines) | stat: -rw-r--r-- 9,292 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<?php
/*
  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
  Copyright (C) 2013-2016  FusionDirectory

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/*!
 * \file jsonrpc.php.doc
 * \brief This is the webservice for FusionDirectory
 *
 * It's a JSON-RPC service usually used through HTTPS. It should be put in the html folder of FusionDirectory
 * Then the url of the webservice will be the url of your FusionDirectory instance followed by /jsonrpc.php
 */

/*!
 * \brief This class is the JSON-RPC webservice of FusionDirectory
 *
 * It must be served through jsonRPCServer::handle
 * */
class fdRPCService
{
  /*!
   * \brief Get the list of configured LDAP servers
   *
   * \return The list of configured LDAP servers as an associative array (keys are ids, values are displayable names)
   */
  function listLdaps() {}
  /*!
   * \brief Login into the webservice
   *
   * \param string $ldap the id of the LDAP server to use (can be NULL, in which case the first LDAP server found is used)
   * \param string $user The user to log in with
   * \param string $pwd The password for this user
   *
   * \return A session ID on success
   */
  function login($ldap, $user, $pwd) {}

  /*!
   * \brief Get list of object of objectType $type in $ou
   *
   * \param string  $sid the session id
   * \param string  $type the objectType to list
   * \param mixed   $attrs The attributes to fetch.
   * If this is a single value, the resulting associative array will have for each dn the value of this attribute.
   * If this is an array, the keys must be the wanted attributes, and the values can be either 1, '*' or 'raw'
   *  depending if you want a single value or an array of values. 'raw' means untouched LDAP value and is only useful for dns.
   *  Other values are considered to be 1.
   * \param string  $ou the LDAP branch to search in, base will be used if it is NULL
   * \param string  $filter an additional filter to use in the LDAP search.
   *
   * \return The list of objects as an associative array (keys are dns)
   */
  function ls ($sid, $type, $attrs = NULL, $ou = NULL, $filter = '')
  {
  }

  /*!
   * \brief Get count of objects of objectType $type in $ou
   *
   * \param string  $sid the session id
   * \param string  $type the objectType to list
   * \param string  $ou the LDAP branch to search in, base will be used if it is NULL
   * \param string  $filter an additional filter to use in the LDAP search.
   *
   * \return The number of objects of type $type in $ou
   */
  function count ($sid, $type, $ou = NULL, $filter = '')
  {
  }

  /*!
   * \brief Get information about objectType $type
   *
   * \param string  $sid the session id
   * \param string  $type the object type
   *
   * \return The information on this type as an associative array
   */
  function infos($sid, $type)
  {
  }

  /*!
   * \brief List existing object types
   *
   * \param string  $sid the session id
   *
   * \return An associative array with types as keys and their names as values
   */
  function listTypes($sid)
  {
  }

  /*!
   * \brief List tabs on an object
   *
   * \param string  $sid the session id
   * \param string  $type the object type
   * \param string  $dn   the object to load values from if any
   *
   * \return List of all tabs on the object, keys are ids, values are array with name (string) and active (boolean) keys.
   */
  function listTabs($sid, $type, $dn = NULL)
  {
  }

  /*!
   * \brief Get all form fields from an object (or an object type)
   *
   * Fields as they appear in the HTML form
   *
   * \param string  $sid  the session id
   * \param string  $type the object type
   * \param string  $dn   the object to load values from if any
   * \param string  $tab  the tab to show if not the main one
   *
   * \return All form fields organized as sections
   */
  function formfields($sid, $type, $dn = NULL, $tab = NULL)
  {
  }

  /*!
   * \brief Update form values of an object's attributes through POST
   *
   * \param string  $sid  the session id
   * \param string  $type the object type
   * \param string  $dn   the object to load values from if any (otherwise it's a creation)
   * \param string  $tab  the tab to modify if not the main one
   * \param array   $post the values as a POST array. Keys should be the 'id' returned by formfields.
   *
   * \return An array with errors if any, the resulting object dn otherwise
   */
  function formpost($sid, $type, $dn, $tab, $post)
  {
  }

  /*!
   * \brief Get all internal FD fields from an object (or an object type)
   *
   * Fields as they are stored in FusionDirectory
   *
   * \param string  $sid  the session id
   * \param string  $type the object type
   * \param string  $dn   the object to load values from if any
   * \param string  $tab  the tab to show if not the main one
   *
   * \return All FD attributes organized as sections
   */
  function getfields($sid, $type, $dn = NULL, $tab = NULL)
  {
  }

  /*!
   * \brief Update attributes values of an object
   *
   * \param string  $sid    the session id
   * \param string  $type   the object type
   * \param string  $dn     the object to load values from if any (otherwise it's a creation)
   * \param array   $values the values as an associative array of associative arrays. First level keys are tabs, second level keys should be the same keys returned by getfields (without section, directly the attributes).
   * Values should be formed as the internal attribute expects them. See the concerned attribute type for more information.
   *
   * \return An array with errors if any, the resulting object dn otherwise
   */
  function setfields($sid, $type, $dn, $values)
  {
  }

  /*!
   * \brief Get needed internal FD fields from a template
   *
   * This returns the fields that needs filling for using this template to create an object.
   * Return value looks like the getfields one, except they are grouped by tab and not by section.
   * Empty activated tab may also be included.
   *
   * \param string  $sid  the session id
   * \param string  $type the object type
   * \param string  $dn   the template dn
   *
   * \return FD attributes organized as tabs
   */
  function gettemplate($sid, $type, $dn)
  {
  }

  /*!
   * \brief Create an object from a template
   *
   * This apply the template to the given values and creates an object.
   *
   * \param string  $sid    the session id
   * \param string  $type   the object type
   * \param string  $dn     the template dn
   * \param string  $values the values for each tab organised in the same way as for setfields
   *
   * \return the created object dn upon success
   */
  function usetemplate($sid, $type, $dn, $values)
  {
  }

  /*!
   * \brief Lock or unlock a user
   *
   * \param string  $sid  the session id
   * \param string  $dns  an array of user dns to be locked, or a single dn of a user to lock
   * \param string  $type the action to be done. Can be 'lock', 'unlock' or 'toggle'. Defaults to 'toggle'.
   */
  function lockUser($sid, $dns, $type = 'toggle')
  {
  }

  /*!
   * \brief Test if a user is locked
   *
   * \param string  $sid  the session id
   * \param string  $dns  an array of user dns to test if they are locked, or a single dn of a user to test
   *
   * \return an associative array of booleans, the keys are the dns of the users
   */
  function isUserLocked($sid, $dns)
  {
  }

  /*!
   * \brief Generate recovery token for a user
   *
   * \param string  $sid    the session id
   * \param string  $email  an email address associated to the user
   *
   * \return an associative array with keys "token" and "uid" upon success
   */
  function recoveryGenToken($sid, $email)
  {
  }

  /*!
   * \brief Change a user password using a recovery token
   *
   * \param string  $sid        the session id
   * \param string  $uid        the uid of the user
   * \param string  $password1  the password entered by the user
   * \param string  $password2  the repeated password entered by the user
   * \param string  $token      the recovery token
   *
   * \return TRUE upon success
   */
  function recoveryConfirmPasswordChange($sid, $uid, $password1, $password2, $token)
  {
  }

  /*!
   * \brief Get the session ID
   *
   * \return The session ID for the current session. (Mainly useless unless you log in with HTTP auth instead of login method)
   */
  function getId ()
  {
  }

  /*!
   * \brief Get the LDAP base
   *
   * \param string  $sid the session id
   *
   * \return The configured LDAP base for the selected LDAP in this webservice session (see login)
   */
  function getBase ($sid)
  {
  }
}
?>