Custom selection script
Andreas Sauer
Active Partner
Hello,
we'd like to set up a security concept where different users can see same projects. It depends on which user group the relevant users belong to. Everything should be dynamic.
The model shows my entities (blue) and the content of them. In my example I have three users which belong to two different user groups and two projects which are assigned to different teams. When a user logs in it should be possible only to see those projects which are assigned to his team.
------------------------------
Andreas Sauer
SPL Tele Group GmbH
Austria
------------------------------
we'd like to set up a security concept where different users can see same projects. It depends on which user group the relevant users belong to. Everything should be dynamic.
The model shows my entities (blue) and the content of them. In my example I have three users which belong to two different user groups and two projects which are assigned to different teams. When a user logs in it should be possible only to see those projects which are assigned to his team.
I tried to do this job with following custom selection script:
select User = @user
select Team = @UserGroup
Due to the relationship between the user and user group the team should be mapped by the second selection but unfortunaltely, it does not work. When I try to open a screen I always get a warning that the Team could not be found.
Is there any way to define dynamic user groups with custom selection script or is there another way?
Thanks in advance.
BR, Andreas
select User = @user
select Team = @UserGroup
Due to the relationship between the user and user group the team should be mapped by the second selection but unfortunaltely, it does not work. When I try to open a screen I always get a warning that the Team could not be found.
Is there any way to define dynamic user groups with custom selection script or is there another way?
Thanks in advance.
BR, Andreas
------------------------------
Andreas Sauer
SPL Tele Group GmbH
Austria
------------------------------
0
Answers
-
Hi @Andreas Sauer,
the first selection will return the internal ID of the UserGroup (Team) and not the entity member itself. Then, the system will try to find the same internal ID in your entity Team.
Apparently, the result of this selection is an empty set.
So the solution would be to build up both entities (UserGroup and Team) in a way that both will have the same internal IDs for the same members. Both should be populated using the same data source.
Kind Regards,
Helmut
------------------------------
Helmut Heimann
Senior Consultant
Board Community
Germany
------------------------------
-------------------------------------------0 -
Hello @Helmut Heimann,
thank you for your answer. I tried as you suggested but unfortunately, it still does not work. I executed following steps:
1. Relationship between User and Ugroup
2. DataReader for User, Ugroup and Team
3. Custom selection script
4. Log in as user "mike" and go to a report. There I get an error message at the data view and the "@-query on Ugroup and Team does not work.
5. Click on refresh on the screen - the data view is loaded and the Ugroup is displayed. The selection on Team is not executed.
Is there an error in the selection script because the entities were empty at the begin and I loaded them with one data reader?
BR, Andreas
-------------------------------------------0