How to find out which workgroup the session user belongs to?

1
0
-1

How to find out which workgroup the session user belongs to?

1 answer

1
+1
-1
This one is the BEST answer!

A user does not belongs to a group but has "memberships". A membership is a group + role combinaison.

You can get the user membership using the identity API (REST or Java).

When you get membership information you get the group id and name.

Comments

Submitted by romualdo.s.rs on Mon, 08/28/2017 - 13:36

Is it possible to find membership according to the username of the session?

Submitted by romualdo.s.rs on Mon, 08/28/2017 - 14:35

I was able to get group and user information in the session, but I can not figure out how to access the user group that is in the session.

To get information from the user I did so:

../API/identity/user?p=0&c=100&f=userName={{session.user_name}}

To access information about groups:

../API/identity/group?p=0&c=100

The results are as follows:

User:

{"firstname":"Romualdo","icon":"../API/avatars/1","creation_date":"2017-06-12
08:56:39.494"
,"userName":"romualdo.santos","title":"Mr","created_by_user_id":"-1","enabled":"true","lastname":"Santos","last_connection":"2017-08-28 08:26:07.869","password":"","manager_id":"0","id":"101","job_title":"Programmer"
,"last_update_date":"2017-08-18 11:25:45.468"}

Group:

[{"path":"/administrador","displayName":"Administrador","icon":"","name":"administrador",
"description":"","parent_path":"","creation_date":"2017-08-18 11:04:28.846","id":"302","created_by_user_id":"-1","last_update_date":"2017-08-18 11:04:28.846"}]
Submitted by antoine.mottier on Mon, 08/28/2017 - 14:35

From session information you can get the user id and then use it in your query to retrieve user memberships.

Submitted by romualdo.s.rs on Mon, 08/28/2017 - 14:38

Could you give an example of how to get membership information by session user ID? I did not understand how to perform this query

Submitted by antoine.mottier on Mon, 08/28/2017 - 14:38

Only a user is associated with a session. So you need to retrieve user membership (including the group information) using a GET request such as: /API/identity/membership?p=0&c=100&f=user_id%3d125&d=group_id

Submitted by romualdo.s.rs on Mon, 08/28/2017 - 14:43

I tried to use your query but it did not return anything, I tried something simpler:../API/identity/membership?p=0&c=100
But even so, nothing has been returned to me.

Submitted by romualdo.s.rs on Mon, 08/28/2017 - 14:50

I tried to replicate the query that is in the documentation just by changing the id of the user and even then nothing was returned to me:

/API/identity/membership?p=0&c=10&f=user_id%3d101&d=role_id

Submitted by romualdo.s.rs on Mon, 08/28/2017 - 14:50

I tried to replicate the query that is in the documentation just by changing the id of the user and even then nothing was returned to me:

/API/identity/membership?p=0&c=10&f=user_id%3d101&d=role_id

Submitted by antoine.mottier on Mon, 08/28/2017 - 14:53

I just test the following query using Bonita Studio and give the expected information about user group: http://localhost:23947/bonita/API/identity/membership?p=0&c=10&f=user_id%3d4&d=group_id

Note that 23947 is the port on my computer but usually default is 8080 and 4is the user id of walter.bates in my test organization.

Submitted by romualdo.s.rs on Mon, 08/28/2017 - 14:59

It worked, I missed my query, forgot to put the .. in the beginning of the query, thanks your help

Notifications