FusionDirectory
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...
 
 removetab ($sid, $type, $dn, $tab)
 Deactivate a tab of 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...
 
 addvalues ($sid, $type, $dn, $values)
 Add values to an object's attributes and save it. More...
 
 delvalues ($sid, $type, $dn, $values)
 Delete values from an object's attributes and save it. 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...
 
 delete ($sid, $type, $dn)
 Delete an object. 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

◆ addvalues()

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

Add values to an object's attributes and save it.

Parameters
string$sidthe session id
string$typethe object type
string$dnthe object dn
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 object dn otherwise

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

◆ count()

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.

◆ delete()

delete (   $sid,
  $type,
  $dn 
)

Delete an object.

Parameters
string$sidthe session id
string$typethe object type
string$dnthe template dn
Returns
An array with errors if any

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

◆ delvalues()

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

Delete values from an object's attributes and save it.

Parameters
string$sidthe session id
string$typethe object type
string$dnthe object dn
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 object dn otherwise

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

◆ formfields()

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 Prefer to use getfields when possible

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 159 of file jsonrpc.php.doc.

◆ formpost()

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

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

Prefer to use setfields if possible

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 176 of file jsonrpc.php.doc.

◆ getBase()

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 355 of file jsonrpc.php.doc.

◆ getfields()

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 192 of file jsonrpc.php.doc.

◆ getId()

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 344 of file jsonrpc.php.doc.

◆ gettemplate()

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 255 of file jsonrpc.php.doc.

◆ infos()

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()

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 308 of file jsonrpc.php.doc.

◆ listLdaps()

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()

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()

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()

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 296 of file jsonrpc.php.doc.

◆ login()

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()

logout (   $sid)

Log out of the webservice.

Parameters
string$sidthe session id
Returns
TRUE

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

◆ ls()

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()

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 335 of file jsonrpc.php.doc.

◆ recoveryGenToken()

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 320 of file jsonrpc.php.doc.

◆ removetab()

removetab (   $sid,
  $type,
  $dn,
  $tab 
)

Deactivate a tab of an object.

Parameters
string$sidthe session id
string$typethe object type
string$dnthe object to remove a tab from
string$tabthe tab to remove
Returns
An array with errors if any, the object dn otherwise

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

◆ setfields()

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 207 of file jsonrpc.php.doc.

◆ usetemplate()

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 271 of file jsonrpc.php.doc.


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