cancel
Showing results for 
Search instead for 
Did you mean: 

Odata filtering by session user

miyanaleem
Participant
0 Kudos

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'.

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor
0 Kudos

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

miyanaleem
Participant
0 Kudos

Hi Florian,

Thank you for replying 🙂

best regards

miyanaleem
Participant
0 Kudos

Hi Florian,

Using calculation scripted view I have got the solution,

my use case is in xsodata file there's an existing entity(table) which is exposed, with in that entity how can i call scripted view?

Thanks,

Answers (0)