Hello guys. So I am developing a reactive web app where I want to allow registered users to login as patients, and allow admins to login as admin. In service center I have an admin role. The login as patient part working fine but its the login as admin part thats giving me a problem. After pressing the "login as admin" it takes you to a screen only accessible to admins, but nothing happenns on my app when someone presses the button, despite it being someone I have granted the admin role. Also the grantrole/checkrole server actions are not usable in the action flow for reactive webapps
Hi Ide Fatsha,
I don't know where you are appling that logic but you can follow below steps. In future if roles increases you can use this method.
1. Add data action and give name as CheckRole and take two Output paramenter as IsAdmin and IsPatient.
2. Inside CheckRole action drag both checkRoles and assign UserId as GetUserId() to both of them.
3. Switch conditon given below and for IsAdmin and IsPatient assign "True" value.
3. Drag CheckRole action in Login screen action.
4. Use switch conditon to navigate to paticular Screen. Thats it.
Hope this will help you.
Thanks,
Regards,
Shubham
The first thing I will suggest you to don't use aggregate for validating registered roles,
ex. you can use "Data Action" for the screen with a output parameter to check its patient or not and inside this call aggregate and filtered particular user and if the user is patient you can assign that output variable as "True".
If you received as "true" navigate to that page else navigate to Admin page or something else as you want. This is the good practice to validated the roles without calling aggregate on screen.
Second, I don't see any Screen to navigate for Admin on screen action "Login as Admin on click".
Third, as discussed in First point, you can apply same logic for Admin.
Let me know if its help you.
Hello, what do you mean by "Data Action"?
Hi @Ide Fatsha,
Data action is when you right click on the screen or block and there is an option fetch data from other sources, it is called as "Data Action"(i have attached the image above).
In this action you can call action related to roles..
Thanks & Regards
Saurabh Singh Sengar
So I am trying to implement the solution s like you suggested but I'm a bit lost as to how to execute my filter, please help
You can go through the steps solution provided by @Shubham Janbandhu .
Regards
I made a demo according to your method, but after clicking the login button, I can only enter the same screen. What should I do?