How i create an users in bonita?

1
0
-1

Hi everybody ,

how i create an users in bonita ? can i create an users with mysql sintax, because i inserted an user with mysql sintax , like this:

INSERT INTO bonita.user_ (tenantid, id, enabled, userName, password, firstName, lastName, title, jobTitle, managerUserId, iconName, iconPath, createdBy, creationDate, lastUpdate) VALUES ('1, '23', '1', 'james','123', james, larson, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)

and , when i enter in bonita portal i don't see this user.

thanks in advanced.

4 answers

1
+1
-1

I wouldn't do this (SQL) at all,

BonitaSoft don't support any manipulation of the User Database so be careful you don't screw it up. they also don't support the creation and use of an XML organization file though this is what we did, we created our own XML file and used this.

First export Acme Organization to an XML file and then change it to your needs...Be careful and use an XML editor to help get it right. You will see the structure, start small and build it up as you go along.

Or create a new Organization with one user, a couple of groups and couple of memberships and build from there.

It will take time. As I say BonitaSoft don't support any manipulation of the user XML file so be careful and you will get there.

regards

Comments

Submitted by sylvain.bailly on Fri, 07/24/2015 - 13:49

Hi,

If you want I can give u a home made connector to create an user account and show you the next step to insert it in the SQL database (simple request). Ask me if you are interested.

Submitted by claz08 on Sat, 07/25/2015 - 23:27

Thanks for your response sylvain , i'm interested in this connector , can you give me it thanks.

Submitted by sylvain.bailly on Mon, 07/27/2015 - 09:44

Hi,

.bar: http://dl.free.fr/tRrBJa6rZ .proc: http://dl.free.fr/nJWHE5rNA

Ask if you want explanations.

Submitted by claz08 on Mon, 07/27/2015 - 16:41

Thanks sylvain , how i can use it?

Submitted by sylvain.bailly on Mon, 07/27/2015 - 17:29

Add me on Skype I can explain u tonight (sylv1.bailly)

Submitted by claz08 on Tue, 07/28/2015 - 17:44

ok sylvain, if it is possible ,i will try to talk with you in this night.

1
0
-1

Hi Antoine, in order to check this code , i have created 2 pages , where the first page it contains a simple form like this :

username:
password:********

and when i press the send button , the user and password is processing in a second page .

this page it contains a part of API authentication , also contains a simple data user request ,and when i execute this code , it shows me the information about the user with id=205 , so for this reason I think that the login system is working good . I don't know where is saved the cookie file in order to verify that the login system is working good.

1)Firstly i want to create an user using PHP CURL, so i have created this code but it doesn't work, because acording the bonita example i have to recieve some response.

/*$conexio2 = curl_init();
$data_array = array("userName" => "prova.prova", "password" => "prova", "password_confirm" => "prova", "firstname" => "prova", "lastname" => "prova");
$data_json = json_encode($data_array);
echo $data_json;
                 
                curl_setopt($conexio2, CURLOPT_URL,'http://localhost:8080/bonita/API/identity/user/');
                curl_setopt($conexio2, CURLOPT_POST, 1);
                curl_setopt($conexio2, CURLOPT_POSTFIELDS, $data_json);
                curl_setopt($conexio2, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($conexio2, CURLOPT_COOKIEJAR, 'cookie2.txt');
                curl_setopt($conexio2, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_json)));
        $result = curl_exec($conexio2);

 //curl_close($conexio2);

2)Secondly , i want to recieve the information about the user that is logged in the sesion.

curl_setopt($ch, CURLOPT_URL, $baseURL.'/API/identity/user/205

where "205" is the user with id=205 but i need, something like this:

curl_setopt($ch, CURLOPT_URL, $baseURL.'/API/identity/user/."$username".

Thanks inadvanced

1
0
-1

HI SeanMcp , i have done the second option , and my problem happens when i want to activate this organization, because i dont know how i do it.

Now i will say , what i want to do:

My final objctive is: to have a web pages where one of these it is the login system. I would like that this system login could verify the username and password in 2 databases, the first is in my personal database and the second is bonita database specifically int the _user table, for this reason i want to know , when bonita database is updated.

the second page that i want to do is named user_registration.php , in this i want to create an user regstration form, and as before i want to create an user in 2 databases , where one of this is my personal database and the other is bonita database .according to what you've told me, i can not use the mysql syntax for write directly in bonita database, also i want to know , how often is the data updated in the bonita database.

Thank in advanced

1
0
-1

Hi Sean Mcp, can you explain me , what did you mean with these words: - First export Acme Organization to an XML file and then change it to your needs. - create a new Organization with one user, a couple of groups and couple of memberships and build from there. execuse me i'm new in BOS version 6.5.

Thanks in advanced

Comments

Submitted by Sean McP on Sun, 07/26/2015 - 10:11

Apologies the two things are separate

DO First OR DO Second

Open Bonita Studio click Organization->Export Select the Organization, change the destination path if necessary Click Finish...

Rename the file to "yourOrganizationName.xml" And edit the file accordingly... change all acme to yourOrganizationName for example...

then import the file, publish it, and use it...

OR

Organization->Manage->Add

and create a new organization with one user etc. and edit as above...

regards

Submitted by claz08 on Sun, 07/26/2015 - 21:47

HI SeanMcp , i have done the second option , and my problem happens when i want to activate this organization, because i dont know how i do it.

Now i will say , what i want to do:

My final objctive is: to have a web pages where one of these it is the login system. I would like that this system login could verify the username and password in 2 databases, the first is in my personal database and the second is bonita database specifically int the _user table, for this reason i want to know , when bonita database is updated.

the second page that i want to do is named user_registration.php , in this i want to create an user regstration form, and as before i want to create an user in 2 databases , where one of this is my personal database and the other is bonita database .according to what you've told me, i can not use the mysql syntax for write directly in bonita database, also i want to know , how often is the data updated in the bonita database.

Thank in advanced

Submitted by antoine.mottier on Mon, 07/27/2015 - 11:24

First of all I think it is important to understand that having user available in Bonita Engine database is mandatory.

So you will need to synchronize your users database with Bonita one. To perform the synchronization you will to create your own tool using Identity API. This API is available either using Java client library or REST .

For Community edition you will need to synchronize both username and password. That's because it is not possible in Community edition to reconfigure user authentication service. Such feature is only available in Subscription edition. Bonita BPM Subscription edition also provide a tool to synchronize users between LDAP/Active Directory and Bonita users database.

Submitted by claz08 on Mon, 07/27/2015 - 16:42

Hi antoine, thanks for your response;

can you give me a bit more explanation please?

regards.

Submitted by antoine.mottier on Mon, 07/27/2015 - 17:32

You need to make sure that all users that exist in your database also exist in Bonita user database (the user_ table).

As you develop using PHP I would recommend to use REST API (take a look at this documentation page that provide a "Create a new user" example). In order to make this call you first need to authenticate (take a look at this other documentation page )

Submitted by claz08 on Mon, 07/27/2015 - 18:29

Hi antoine, now i have a login system that it allow me to connect with API REST , and it's running good using PHP CURL,my great problem is , how to adapt this information from bonita documentation in my code.

Create a new user

Request url POST |/API/identity/user Request payload

{
"userName":"New.User",
"password":"bpm",
"password_confirm":"bpm",
"icon":"",
"firstname":"New",
"lastname":"User",
"title":"Mr",
"job_title":"Human resources benefits",
"manager_id":"3",
"professional_data_address":"Renwick Drive",
"professional_data_city":"Philadelphia",
"professional_data_country":"United States",
"professional_data_zipcode":"19108",
"professional_data_state":"PA",
"professional_data_email":"walter.bates@acme.com",
"professional_data_phone_number":"484-302-5409",
"professional_data_mobile_number":"",
"personnal_data_address":"",
"personnal_data_city":"",
"personnal_data_country":"",
"personnal_data_zipcode":"",
"personnal_data_state":"",
"personnal_data_email":"",
"personnal_data_phone_number":"",
"personnal_data_mobile_number":""
}
Response payload
{
"last_connection":"",
"created_by_user_id":"4",
"creation_date":"2014-12-09 17:43:28.291",
"id":"101",
"icon":"/default/icon_user.png",
"enabled":"false",
"title":"Mr",
"manager_id":"3",
"job_title":"Human resources benefits",
"userName":"New.User",
"lastname":"New",
"firstname":"User",
"password":"",
"last_update_date":"2014-12-09 17:43:28.291"}

**This is my PHP CODE:**

                $baseURL = 'http://localhost:8080/bonita/';
                $username = $usuari;
                $password = $password;
                echo"<b>usuari:</b> ".$_POST['usuari'];
                echo"<br>";
                echo"<b>password:</b>".$_POST['password'];
                echo"<br>";
               
                $conexio = curl_init();
                //Apertura sesio API REST
                $data = array('username' => $username, 'password' => $password, 'redirect' => 'false');
                curl_setopt($conexio, CURLOPT_URL, $baseURL.$log_in_out);
                curl_setopt($conexio, CURLOPT_POST, 1);
                curl_setopt($conexio, CURLOPT_POSTFIELDS,http_build_query($data));
                curl_setopt($conexio, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($conexio, CURLOPT_COOKIEJAR, 'cookie.txt');
                curl_exec($conexio);
           
                //user query
                **curl_setopt($conexio, CURLOPT_URL, $baseURL.'API/identity/user/206');
                curl_setopt($conexio, CURLOPT_POST, 0);
                $response_post = curl_exec($conexio);**
       
                curl_close($conexio);
                       
        if($response_post ==false){
   echo"<p style='color:red'><b>there aren't any response!</b></p>";
 
        }
        else{
                echo"<br>";
                echo "<DIV style='color:blue;font-size:15px;border-style:solid;position:relative'>".$response_post."</DIV>";   
                echo"<br>";
                echo"<br>";
                echo"<br>";
         
                }
        }
Submitted by claz08 on Mon, 07/27/2015 - 20:30

somebody can give me some example in order to implement in my code , thanks

Submitted by antoine.mottier on Tue, 07/28/2015 - 11:31

Can you explain what does work in your code?

Did you manage to successfully go through the authentication phase? Did you get the cookie with the session id information?

Submitted by claz08 on Tue, 07/28/2015 - 16:50

Hi Antoine, in order to check this code , i have created 2 pages , where the first page it contains a simple form like this :

username:
password:********

and when i press the send button , the user and password is processing in a second page .

this page it contains a part of API authentication , also contains a simple data user request ,and when i execute this code , it shows me the information about the user with id=205 , so for this reason I think that the login system is working good . I don't know where is saved the cookie file in order to verify that the login system is working good.

1)Firstly i want to create an user using PHP CURL, so i have created this code but it doesn't work, because acording the bonita example i have to recieve some response. look at this :http://documentation.bonitasoft.com/web-rest-api-examples-0#create_user

/*$conexio2 = curl_init();
$data_array = array("userName" => "prova.prova", "password" => "prova", "password_confirm" => "prova", "firstname" => "prova", "lastname" => "prova");
$data_json = json_encode($data_array);
echo $data_json;
                 
                curl_setopt($conexio2, CURLOPT_URL,'http://localhost:8080/bonita/API/identity/user/');
                curl_setopt($conexio2, CURLOPT_POST, 1);
                curl_setopt($conexio2, CURLOPT_POSTFIELDS, $data_json);
                curl_setopt($conexio2, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($conexio2, CURLOPT_COOKIEJAR, 'cookie2.txt');
                curl_setopt($conexio2, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_json)));
        $result = curl_exec($conexio2);

 //curl_close($conexio2);

2)Secondly , i want to recieve the information about the user that is logged in the sesion.

curl_setopt($ch, CURLOPT_URL, $baseURL.'/API/identity/user/205

where "205" is the user with id=205 but i need, something like this:

curl_setopt($ch, CURLOPT_URL, $baseURL.'/API/identity/user/."$username".

Thanks inadvanced

Submitted by claz08 on Tue, 07/28/2015 - 17:36

here i show you the response when i execute the code.

RESPONSE

finally i can verify the cookie file :

# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

#HttpOnly_localhost     FALSE   /bonita/        FALSE   0       JSESSIONID      95606A5E1D18489BE7AF3091CC739403

what does it mean ?

Submitted by claz08 on Thu, 07/30/2015 - 20:58

Hi , finally , i have managed to create an user using API REST, but when trying to login in my system , using this user recently created , i not could.

how can i resolve this problem ?

Thanks

Notifications