How to assign values to UserInfo block

How to assign values to UserInfo block

  

Hi,

I'm building a mobile application and not using the user data base provided by OutSystems. Thus, all my screens are anonymous, as prescribed by OutSystems, but should be authenticated by the external source.

The external source defines the Roles and Access privileges for the respective screens. Thus, i'm now confused to decided the right mechanism to authenticate as well as authorise. Yet, as there is a possibility to set any screen as "Mark as Default Screen", could place my authentication on the home page. Now the problem is to assign the UserInfo block with the user information. So that, when the left menu is popped up, it will show the authenticated user.

Point 1) How can i assign the value to UserInfo block from any given screen. As I couldn't find the scope within the screen that can access UserInfo block.

Point 2) How to change the items from Menu block or Bottom Bar depending on the Role of the authenticated user. Well I can include the links within IF block, but I couldn't find any variable scope within the condition window, that can be used for constructing the condition. Hence the question.

Thanks for reading till this line.

Regards,

Hi DSK,

Since there is no Session on mobile, after authenticating the user, you can store the user's information in the local database. On every screen you can put a Block (e.g. in a header Place Holder) that in its Preperation reads the local database to retrieve the currently logged on user and display e.g. their name.

For a menu, you could do the same (reading the local database), but perhaps it's better to abstract that, and create a Client eSpace that exposes privilige Actions, etc.

Kilian Hekhuis wrote:

Hi DSK,

Since there is no Session on mobile, after authenticating the user, you can store the user's information in the local database. On every screen you can put a Block (e.g. in a header Place Holder) that in its Preperation reads the local database to retrieve the currently logged on user and display e.g. their name.

For a menu, you could do the same (reading the local database), but perhaps it's better to abstract that, and create a Client eSpace that exposes privilige Actions, etc.

Killian,

Thank you for your timely response. Not sure that I understood your point of putting a Block for validating the user. Let me iterate. 

First, create a block at common with a label (or) expression. Fetch data from local storage to show the detail for the user within this block.  Drag it on Menu, so that I will appear as like UserInfo block. Am I right?

Second, on successful authentication on my login screen, at "xxOnClick" event, store the user details onto local storage. So that, it can be used for all pages. Correct me, if I have mistaken you.

Third, use the locally stored data towards changing the items on BottomBar / Menu. But the point is, if i have n items, then i have to have n IF conditions for each item to validate their business purpose. I'm thinking that this is a kind of mundane job. Please throw some light on any other mechanism than having individual IF conditions for each item.

Finally, let me know if you have come across of  any tutorial on creating and retrieving local data.

Regards,

Hi DSK,

As for the third item, you could indeed use Ifs. For a Web App, one could use a Static Entity that also encodes Priviliges, and contains the links to the pages, but for a Mobile App I think such an approach would be difficult (for one, I don't know how to link to another, variable screen).