Skip to Content
Jul 10, 2014 at 05:17 AM

Best way to design the return of an Employee Entity for current logged in User?


Hi All,

I want to return an employee entity for the currently logged in User for a UI5 app. Now since my employee entity has a username filter, I could call service/employees(filter=Username eq 'myuname') but I'm not sure how easy it is for a UI5 app to generically work out the user id since authentication could be done in numerous ways in the browser.

Hence I want to provide the ui5 development a service to return an employee entity for the current logged in user.

Question: How should I do this?

Option a: Create a function import called GetCurrentLoggedInEmployee that returns an Employee entity.

This is very obvious and probably what I'm thinking is the right way.

Option b: Call a generic Gateway service that exists that I don't know about that returns the username???

Option c: ??? Pretty sure I can't navigate from an Employees entity so struggling to think of other nice options.

Please note: I haven't looked at how Fiori apps do this which could hold the key.

Thanks for any advice you can give,