Project

General

Profile

force the user visibility for TimeEntryQuery

Added by Sonia Zh almost 9 years ago

It seems like a query (in my case TimeEntryQuery) depends of the right-permission of the current user (User.current).
I would like to run automatically by the server a 'check' from my plugin.
This check needs for inputs some user's logged_time from TimeEntry.
I am using a TimeEntryQuery such as :

TimeEntryQuery.new(project: Project.find(10)).results_scope

But it will return nothing because by default the User.current = User.first a.k.a. Anonymous which does not have much rights

Is it possible to get the Value of the query without changing the User.current ?

Let me know if I was not clear...

Thanks in advance !