Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
i need some help with PM Web Service.
My installed version is:
O.S. - Windows NT PROCESSMAKERSRV 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
PM 3.2
PHP 5.6.38
Im developing a Project in visual studio.
I have a connected service to this url http://processmakersrv/sysWork/es-ES/ne ... ices/wsdl2
Then i used the reference for access to the methods of the service.
When i create a new user, i cant find where can i set the authentication by Active directory (wich is configured by the web interface)
this is the method with i get all the users
Code: Select all
Public Shared Function listarUsuarios(message As String) As List(Of Empleado)
        Dim _pmakersoapclient As New ProcessMakerServiceSoapClient()
        Dim _version As String = ""
        Dim _timestamp As String = ""
        Dim infoSTR As informationUserStruct() = Nothing
        Dim txt As String = ""
        Dim listaEmpleados As New List(Of Empleado)
        Dim lista As userListStruct() = _pmakersoapclient.userList(message)
        For index = 0 To lista.Count - 1
            Dim empleado As New Empleado
            Dim response As String = _pmakersoapclient.informationUser(message, lista.ElementAt(index).guid, txt, _timestamp, infoSTR)
            empleado.pIdUsuario = infoSTR(0).username
            empleado.pNombre = infoSTR(0).firstname
            empleado.pApellidos = infoSTR(0).lastname
            empleado.pCorreo = infoSTR(0).mail
            empleado.pDireccion = infoSTR(0).address
            empleado.pCodPostal = infoSTR(0).zipcode
            empleado.pPais = infoSTR(0).country
            empleado.pTelefono = infoSTR(0).phone
            empleado.pFax = infoSTR(0).fax
            empleado.pMovil = infoSTR(0).cellular
            empleado.pNacimiento = infoSTR(0).birthday
            empleado.pPosicion = infoSTR(0).position
            empleado.pReemplazadoPor = infoSTR(0).replacedby
            empleado.pDuadate = infoSTR(0).duedate
            empleado.pCalendar = infoSTR(0).calendar
            empleado.pEstado = infoSTR(0).status
            empleado.pDepartamento = infoSTR(0).department
            empleado.pReportsto = infoSTR(0).reportsto
            empleado.pUserExperience = infoSTR(0).userexperience
            empleado.pFoto = infoSTR(0).photo
        Return listaEmpleados
    End Function
and this is the method with i create a new user.
Code: Select all
Private Shared Function createUser(ByVal _sessionID As String, emple As Empleado) As createUserResponse
        Dim _pmakersoapclient As New ProcessMakerServiceSoapClient()
        Dim _response As New createUserResponse
        Dim duedate As String() = Nothing
        Dim _statuscode As String = ""
        Dim status As String() = Nothing
        Dim _message As String = ""
        Dim _timestamp As String = ""
        Dim _userUID As String = emple.pIdUsuario
        _statuscode = _pmakersoapclient.createUser(_sessionID, _userUID, emple.pNombre, emple.pApellidos, emple.pCorreo, emple.pRol, emple.pPassword, duedate, status, _message, _userUID, _timestamp)
        _response.message = _message
        _response.status_code = _statuscode
        _response.timestamp = _timestamp
        _response.userUID = _userUID
        Return _response
    End Function
in both situations i have the same problem, i want to set and get the configuration of the authentication with active directory

thx 4 help
We don't have a web service to import a user from Active Directory.

If you are using the Enterprise Edition, Advanced LDAP/AD has a Synchronization option to automatically import new users from LDAP/Active Directory.

If you are using the Community Edition, then you can manually import new users from LDAP/AD in the ProcessMaker interface.

You can look through the code in the Community Edition to find the function to import users from LDAP/AD and put that in a trigger and then write a script that calls the executeTrigger() web service and execute that script as cron job in Linux or a Scheduled Task in Windows.

Here is some trigger code to get you started. You will have to figure the rest out on your own:
Code: Select all
global $RBAC;
//get this ID from RBAC_AUTHENTICATION_SOURCE.AUTH_SOURCE_UID field in the database:
$authSourceId = '1234567890abcde1234567890abcde'; 
$nameSearch = "john";

$aFields = $RBAC->getAuthSource( $authSourceId );
$i = 0;
$oUser = new Users();
$aAux = $RBAC->searchUsers( $authSourceId, $nameSearch );
$aUsers = array ();
$aUsers[] = array ('Checkbox' => 'char','Username' => 'char','FullName' => 'char','FirstName' => 'char','LastName' => 'char','Email' => 'char','DistinguishedName' => 'char');
 foreach ($aAux as $aUser) {
                if (! in_array( $aUser['sUsername'], $pmUsers )) {
                    // add replace to change D'Souza to D*Souza by krlos
                    $sCheckbox = '<div align="center"><input type="checkbox" name="aUsers[' . $i . ']" id="aUsers[' . $i . ']" value=\'' . str_replace( "\'", "*", addslashes( Bootstrap::json_encode( $aUser ) ) ) . '\' /></div>';
                    $i ++;
                } else {
                    $sCheckbox = G::LoadTranslation( 'ID_USER_REGISTERED' ) . ':<br />(' . $aUser['sUsername'] . ')';
                // note added by gustavo cruz
                // assign the user data to the DBArray variable.
                $aUsers[] = array ('Checkbox' => $sCheckbox,'Username' => $aUser['sUsername'],'FullName' => $aUser['sFullname'],'FirstName' => $aUser['sFirstname'],'LastName' => $aUser['sLastname'],'Email' => $aUser['sEmail'],'DistinguishedName' => $aUser['sDN']
See the files:

If you are good at PHP, you can figure it out from there.

When you are inside the ProcessMaker interface and[…]

you can update user information with rest api (PUT[…]

To create a message to be sent to an assigned user[…]

The URL is generated in the file workflow/engine[…]