Change a button visible property by role in mobile

Hello everyone,

when we are working in outsystems 10 web version, we can turn a Button visible with the condition (CheckOSMDbAdminRole(UserId:)). In mobile version, can i do that? I tried the same way, but it doesn't allow me.

Thanks ,

João Bernardes.

Solution

Hi Joao,

In P10 the roles are server side and are not automatically available on clientside (screens).

You can perform the query on the server after login and store the results in the local storage.

The button can then be shown after you query the local storage.

Kind regards,

Remco Dekkinga

Solution

Remco Dekkinga wrote:

Hi Joao,

In P10 the roles are server side and are not automatically available on clientside (screens).

You can perform the query on the server after login and store the results in the local storage.

The button can then be shown after you query the local storage.

Kind regards,

Remco Dekkinga

Thank you!!


Hi, I have the same problem, but I don't know how to solve it, how do I add the code? outsystem 10

Hi Maroan,

You are awaking an 2 year old post. It is better to post a new one, and refer to the old post.

That way if someone gives you a solution, you also will be able to mark it as such and help potentially others finding quicker a solution.

The answer to your question can be found here: https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/JavaScript_API/Security

checkIfCurrentUserHasRole(roleKey: string): boolean

Checks if the current user has the given role.

Tip: module roles are available through the $roles pre-defined object.

Regards,

Daniel