FusionDirectory
 All Data Structures Files Functions Variables
Public Member Functions
fdRPCService Class Reference

This class is the JSON-RPC webservice of FusionDirectory. More...

Public Member Functions

 listLdaps ()
 Get the list of configured LDAP servers. More...
 
 login ($ldap, $user, $pwd)
 Login into the webservice. More...
 
 logout ($sid)
 Log out of the webservice. More...
 
 ls ($sid, $type, $attrs=NULL, $ou=NULL, $filter= '')
 Get list of object of objectType $type in $ou. More...
 
 count ($sid, $type, $ou=NULL, $filter= '')
 Get count of objects of objectType $type in $ou. More...
 
 infos ($sid, $type)
 Get information about objectType $type. More...
 
 listTypes ($sid)
 List existing object types. More...
 
 listTabs ($sid, $type, $dn=NULL)
 List tabs on an object. More...
 
 formfields ($sid, $type, $dn=NULL, $tab=NULL)
 Get all form fields from an object (or an object type) More...
 
 formpost ($sid, $type, $dn, $tab, $post)
 Update form values of an object's attributes through POST. More...
 
 getfields ($sid, $type, $dn=NULL, $tab=NULL)
 Get all internal FD fields from an object (or an object type) More...
 
 setfields ($sid, $type, $dn, $values)
 Update attributes values of an object. More...
 
 gettemplate ($sid, $type, $dn)
 Get needed internal FD fields from a template. More...
 
 usetemplate ($sid, $type, $dn, $values)
 Create an object from a template. More...
 
 lockUser ($sid, $dns, $type= 'toggle')
 Lock or unlock a user. More...
 
 isUserLocked ($sid, $dns)
 Test if a user is locked. More...
 
 recoveryGenToken ($sid, $email)
 Generate recovery token for a user. More...
 
 recoveryConfirmPasswordChange ($sid, $uid, $password1, $password2, $token)
 Change a user password using a recovery token. More...
 
 getId ()
 Get the session ID. More...
 
 getBase ($sid)
 Get the LDAP base. More...
 

Detailed Description

This class is the JSON-RPC webservice of FusionDirectory.

It must be served through jsonRPCServer::handle

Definition at line 34 of file jsonrpc.php.doc.

Member Function Documentation

count (   $sid,
  $type,
  $ou = NULL,
  $filter = '' 
)

Get count of objects of objectType $type in $ou.

Parameters
string$sidthe session id
string$typethe objectType to list
string$outhe LDAP branch to search in, base will be used if it is NULL
string$filteran additional filter to use in the LDAP search.
Returns
The number of objects of type $type in $ou

Definition at line 92 of file jsonrpc.php.doc.

formfields (   $sid,
  $type,
  $dn = NULL,
  $tab = NULL 
)

Get all form fields from an object (or an object type)

Fields as they appear in the HTML form

Parameters
string$sidthe session id
string$typethe object type
string$dnthe object to load values from if any
string$tabthe tab to show if not the main one
Returns
All form fields organized as sections

Definition at line 144 of file jsonrpc.php.doc.

formpost (   $sid,
  $type,
  $dn,
  $tab,
  $post 
)

Update form values of an object's attributes through POST.

Parameters
string$sidthe session id
string$typethe object type
string$dnthe object to load values from if any (otherwise it's a creation)
string$tabthe tab to modify if not the main one
array$postthe values as a POST array. Keys should be the 'id' returned by formfields.
Returns
An array with errors if any, the resulting object dn otherwise

Definition at line 159 of file jsonrpc.php.doc.

getBase (   $sid)

Get the LDAP base.

Parameters
string$sidthe session id
Returns
The configured LDAP base for the selected LDAP in this webservice session (see login)

Definition at line 293 of file jsonrpc.php.doc.

getfields (   $sid,
  $type,
  $dn = NULL,
  $tab = NULL 
)

Get all internal FD fields from an object (or an object type)

Fields as they are stored in FusionDirectory

Parameters
string$sidthe session id
string$typethe object type
string$dnthe object to load values from if any
string$tabthe tab to show if not the main one
Returns
All FD attributes organized as sections

Definition at line 175 of file jsonrpc.php.doc.

getId ( )

Get the session ID.

Returns
The session ID for the current session. (Mainly useless unless you log in with HTTP auth instead of login method)

Definition at line 282 of file jsonrpc.php.doc.

gettemplate (   $sid,
  $type,
  $dn 
)

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.

Parameters
string$sidthe session id
string$typethe object type
string$dnthe template dn
Returns
FD attributes organized as tabs

Definition at line 207 of file jsonrpc.php.doc.

infos (   $sid,
  $type 
)

Get information about objectType $type.

Parameters
string$sidthe session id
string$typethe object type
Returns
The information on this type as an associative array

Definition at line 104 of file jsonrpc.php.doc.

isUserLocked (   $sid,
  $dns 
)

Test if a user is locked.

Parameters
string$sidthe session id
string$dnsan array of user dns to test if they are locked, or a single dn of a user to test
Returns
an associative array of booleans, the keys are the dns of the users

Definition at line 246 of file jsonrpc.php.doc.

listLdaps ( )

Get the list of configured LDAP servers.

Returns
The list of configured LDAP servers as an associative array (keys are ids, values are displayable names)

Definition at line 41 of file jsonrpc.php.doc.

listTabs (   $sid,
  $type,
  $dn = NULL 
)

List tabs on an object.

Parameters
string$sidthe session id
string$typethe object type
string$dnthe object to load values from if any
Returns
List of all tabs on the object, keys are ids, values are array with name (string) and active (boolean) keys.

Definition at line 128 of file jsonrpc.php.doc.

listTypes (   $sid)

List existing object types.

Parameters
string$sidthe session id
Returns
An associative array with types as keys and their names as values

Definition at line 115 of file jsonrpc.php.doc.

lockUser (   $sid,
  $dns,
  $type = 'toggle' 
)

Lock or unlock a user.

Parameters
string$sidthe session id
string$dnsan array of user dns to be locked, or a single dn of a user to lock
string$typethe action to be done. Can be 'lock', 'unlock' or 'toggle'. Defaults to 'toggle'.

Definition at line 234 of file jsonrpc.php.doc.

login (   $ldap,
  $user,
  $pwd 
)

Login into the webservice.

Parameters
string$ldapthe id of the LDAP server to use (can be NULL, in which case the first LDAP server found is used)
string$userThe user to log in with
string$pwdThe password for this user
Returns
A session ID on success

Definition at line 52 of file jsonrpc.php.doc.

logout (   $sid)

Log out of the webservice.

Parameters
string$sidthe session id
Returns
TRUE

Definition at line 61 of file jsonrpc.php.doc.

ls (   $sid,
  $type,
  $attrs = NULL,
  $ou = NULL,
  $filter = '' 
)

Get list of object of objectType $type in $ou.

Parameters
string$sidthe session id
string$typethe objectType to list
mixed$attrsThe 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.
string$outhe LDAP branch to search in, base will be used if it is NULL
string$filteran additional filter to use in the LDAP search.
Returns
The list of objects as an associative array (keys are dns)

Definition at line 78 of file jsonrpc.php.doc.

recoveryConfirmPasswordChange (   $sid,
  $uid,
  $password1,
  $password2,
  $token 
)

Change a user password using a recovery token.

Parameters
string$sidthe session id
string$uidthe uid of the user
string$password1the password entered by the user
string$password2the repeated password entered by the user
string$tokenthe recovery token
Returns
TRUE upon success

Definition at line 273 of file jsonrpc.php.doc.

recoveryGenToken (   $sid,
  $email 
)

Generate recovery token for a user.

Parameters
string$sidthe session id
string$emailan email address associated to the user
Returns
an associative array with keys "token" and "uid" upon success

Definition at line 258 of file jsonrpc.php.doc.

setfields (   $sid,
  $type,
  $dn,
  $values 
)

Update attributes values of an object.

Parameters
string$sidthe session id
string$typethe object type
string$dnthe object to load values from if any (otherwise it's a creation)
array$valuesthe 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.
Returns
An array with errors if any, the resulting object dn otherwise

Definition at line 190 of file jsonrpc.php.doc.

usetemplate (   $sid,
  $type,
  $dn,
  $values 
)

Create an object from a template.

This apply the template to the given values and creates an object.

Parameters
string$sidthe session id
string$typethe object type
string$dnthe template dn
string$valuesthe values for each tab organised in the same way as for setfields
Returns
the created object dn upon success

Definition at line 223 of file jsonrpc.php.doc.


The documentation for this class was generated from the following file: