ndegoeij
I'm new here

Retrieve user and group information in Query

I want to build a Filter Query based on user information. In our FirstSpirit system we have created lots of users and groups. These groups have specific rights in the system. What I would like to do now is create a CMS_INPUT_COMBOBOX with a filter on it. This CMS_INPUT_COMBOBOX shows data from another table. This data contains also a reference to a table with the groups which are allowed to see this data. Within this filter I would like to test if the user who is logged in at that certain moment matches the specified group.

Is it possible to retrieve user information as well as group information of the user that is currently logged in and can this information be used in a Query?

0 Kudos
6 Replies
Karsten
I'm new here

unfortunately not. Have the same requirement ... 😞

That is a pitty... but nothing to do about it at the moment. Thank you for your reply. Then I don't need to look further anymore.

0 Kudos
MarsDD
Occasional Observer

Hy,

i have the same problem ... but i get the current user information with an jsp code ...

de.espirit.firstspirit.access.User user = de.espirit.firstspirit.io.servlet.WebAuthentication.getConnection(request).getUser().getUser();

 

String name = user.getRealname().toString();

If i have more information how u put this result in a query ... i would be tell u

best regards

Marcel

This sounds promising Marcel.

If I have time to dig in to this and find a way to also get more of this information in plain Java code together with group info I will let you know here too.

Thank you for your reply.

0 Kudos
MarsDD
Occasional Observer

Did you mean with group information in which group the user are?

If yes ... so you could get all groups of the current user

de.espirit.firstspirit.access.project.Project project = de.espirit.firstspirit.io.servlet.WebAuthentication.getConnection(request).getProjectById( $CMS_VALUE(#global.project.id)$ );

de.espirit.firstspirit.access.User user = de.espirit.firstspirit.io.servlet.WebAuthentication.getConnection(request).getUser().getUser( );

java.util.List groups = project.getGroups(user);

best regards

Marcel

0 Kudos
TimoMeister
Returning Responder

I tried this: #global.project.getUserService().getUser().getLoginName() but this returns "SYSTEM". Why? What I would like to have is the current user.

0 Kudos