Skip to Content
0

Odata filtering by session user

Nov 30, 2017 at 02:13 PM

74

avatar image

HI, in my table created_by field is there. that is inserted from backend through session_user in-build function. i am running xsodata file i need to filter craeted_by filed based on current user. I dont know the created_by name i have to fetch from session_user. how to fetch by giving $filter=Created_by eq 'session_user'.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Florian Pfeffer
Nov 30, 2017 at 04:36 PM
0

I don't think that you wanna pass the user ID as OData filter parameter, because with that, everyone can do a query for different users (which I think should not be the case). Of course if in the backend are analytical privileges defined which avoids that, that would be no big issue from a security point of view, but in most cases I think there is no such AP.

An option would be to create a calc. view or table function which restricts internally to the current user. Such a calc. view or table function can be exposed as OData service. Advantage for you: You do not have to provide the user when you call the service, because the restriction is done internally (less coding for the caller and secure).

Maybe you wanna search here in the forum, because that topic was already discussed several times.

Regards,
Florian

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Florian,

Thank you for replying :-)

best regards

0