Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with analytics background job #126

Closed
juliushaertl opened this issue Feb 14, 2023 · 9 comments
Closed

Issue with analytics background job #126

juliushaertl opened this issue Feb 14, 2023 · 9 comments
Labels
bug Something isn't working
Milestone

Comments

@juliushaertl
Copy link
Member

juliushaertl commented Feb 14, 2023

@datenangebot
i just found a possible issue with the datasource in a certain combination (when scheduling unattended dataloads).
What is your release plan?

Analyitcs has scheduled dataloads via cron. for these jobs, no current user is active and I am getting this error:
OCA\\\\Tables\\\\Service\\\\PermissionsService::__construct(): Argument #2 ($userId) must be of type string, null given

Originally posted by @Rello in #121 (comment)

@juliushaertl juliushaertl added the bug Something isn't working label Feb 14, 2023
@juliushaertl juliushaertl added this to the v0.3.0 milestone Feb 14, 2023
@Rello
Copy link
Contributor

Rello commented Feb 14, 2023

Hi,
Analytics was modified in the current version to catch this problem and not break any job anymore.

I will search for a fix for the initial issue.

Currently, this new datasource is working as expected in normal use. Just unattended dataloads from Tables->Analytics are not possible. But this use case is very limited anyway

@datenangebot
Copy link
Collaborator

datenangebot commented Feb 17, 2023

I have to rethink my setup to run without users in context. But I need that also for other things, fix will come shortly.

@Rello I'm not sure, if I can make the data accessible via the API without a user in context due to security reasons.

@Rello
Copy link
Contributor

Rello commented Feb 17, 2023

Hi,
this does not have to be the case. I have similar challenges when loading data from files during cron.
On Analytics side I have the user in context (the owner of the dataload) available. this would not be the issue.

But I do not have a way to hand it over as a $userid variable at the moment.

perhaps @juliushaertl can help here.
I think this line is the problem
https://github.com/nextcloud/tables/blob/feat/v0.3.0/lib/Service/ColumnService.php#L23
parent::__construct($logger, $userId, $permissionsService);

why is this needed? the function construct should be enough already

@juliushaertl
Copy link
Member Author

The service has a parent class which needs the user id.

One option might be to allow nullable user ids during dependency injection and then offer a way to set the user context manually through a method.

@datenangebot
Copy link
Collaborator

I am working on a general solution to handle requests with different users than the user from the session. This is needed for some occ commands to manipulate something as an administrator...
That will also fix this issue with the dataload.
But I don't like to fix this one class, I will do it for all classes the same way. Stay tuned 😄

@datenangebot datenangebot modified the milestones: v0.3.0, v0.3.2 Mar 1, 2023
@datenangebot
Copy link
Collaborator

datenangebot commented Mar 1, 2023

The service has a parent class which needs the user id.

One option might be to allow nullable user ids during dependency injection and then offer a way to set the user context manually through a method.

@juliushaertl is it possible to set the userId in the \OC::$server instance or manipulate the initial request?
Otherwise I have to write all the logic independent from the server-container-userId?

@datenangebot
Copy link
Collaborator

Related to

Currently, this new datasource is working as expected in normal use. Just unattended dataloads from Tables-> Analytics are not possible. But this use case is very limited anyway

I will stopp here, fetching data needs a user in context otherwise security checks are not possible. With the ability for public sharing this might become possible with an access token...

For now I close this issue.

@Rello
Copy link
Contributor

Rello commented Mar 15, 2023

agreed
thank you

@Rello
Copy link
Contributor

Rello commented Jul 31, 2023

@datenangebot
wanted to check back on this. It turned out that the same issue exists, if I share a report via external link. In this case, there is no user session.

I would need an api where the userid can be handed over in a variable.
Did any new ideas already come up in the last months?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants