480
Views
5
Comments
Solved
roles and access screen permission
Hello everyone, I am developing an app with outsystems that allows access to certain screens depending on two roles that I have already created

What should I do so that after the user logs in, due to the role that has fence to home or home2.
Thanks for all =)
2021-06-02 20-50-04
Márcio Carvalho
Solution

Now is perfect, is using, a data action, where when the User does the login, he checks which role has the user, and he redirects to a screen depending on the role :)

Enjoy, anything says, check if it's the solution you are trying to find.


Data Action


Checking role with the data action on the login action.

Kind Regards,

Márcio C.

checkrole.oml
2021-06-02 20-50-04
Márcio Carvalho

Check if the user has that role with its userid, and then retrieve if it has or not, and check to which place he goes

UserImage.jpg
Mauricio Latorre

@Marcio Carvalho thank you for you answer, but, I don't know where or how to do that 

2021-06-02 20-50-04
Márcio Carvalho

I did on reactive, but you can do (copy/paste) the same logic on mobile, no worries

2021-06-02 20-50-04
Márcio Carvalho
Solution

Now is perfect, is using, a data action, where when the User does the login, he checks which role has the user, and he redirects to a screen depending on the role :)

Enjoy, anything says, check if it's the solution you are trying to find.


Data Action


Checking role with the data action on the login action.

Kind Regards,

Márcio C.

checkrole.oml
UserImage.jpg
joseph j sherman

To achieve this in your OutSystems app, you can use the Role-based access control (RBAC) feature. Here's a simple outline of what you can do:

  1. Define Roles: Ensure you have already created the roles (e.g., "fence" and "home2") in your OutSystems application.

  2. Assign Roles to Users: Assign the roles to users during user management or registration.

  3. Implement Screen Access Logic: In your app, implement logic to check the user's role after login and redirect them accordingly.

Here's a basic example of how you might implement this logic:

javascriptCopy code// Assuming you have a user variable with the user's role storedif (User.Role = "fence") {    // Redirect to the "Fence Screen"    Navigate(YourFenceScreen);} else if (User.Role = "home2") {    // Redirect to the "Home2 Screen"    Navigate(YourHome2Screen);} else {    // Redirect to a default screen or show an error message    Navigate(DefaultScreen);}

Make sure to replace Your Fence Screen, YourHome2Screen, and DefaultScreen with the actual screen names in your app.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.