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

CSV expander queue worker fails to generate ADO ingest update queue items when run from cron or hydroponics #214

Closed
patdunlavey opened this issue Aug 30, 2024 · 1 comment
Labels
bug Something isn't working Drupal 10 enhancement New feature or request queue workers Ones taking the FI and doing the FO Reporting Errors, Logs, etc.
Milestone

Comments

@patdunlavey
Copy link
Contributor

The reason is because, when running under cron and AmiUtilityService::preprocessAmiSet() is called from...

$info = $this->AmiUtilityService->preprocessAmiSet($data->info['csv_file'], $data, $invalid, FALSE);

... the current user is anonymous (0), and as a result the access check...
if (!$existing_object || !$existing_object->access('update')) {

... fails.

After discussion on slack, we agreed that it made sense to replicate the logic from...

$account = $data->info['uid'] == \Drupal::currentUser()->id() ? \Drupal::currentUser() : $this->entityTypeManager->getStorage('user')->load($data->info['uid']);
if ($data->pluginconfig->op !== 'create' && $account && $existing && count($existing) == 1) {
$existing_object = reset($existing);
if (!$existing_object->access('update', $account)) {

... where the access check is performed using the user account provided in the AMI set.

PR forthcoming!

@DiegoPino DiegoPino added bug Something isn't working enhancement New feature or request Reporting Errors, Logs, etc. queue workers Ones taking the FI and doing the FO Drupal 10 labels Aug 30, 2024
@DiegoPino DiegoPino added this to the 0.8.0 milestone Aug 30, 2024
@DiegoPino
Copy link
Member

@patdunlavey thanks for opening this. Fixed via
bfdb7c5
and
567fea5

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Drupal 10 enhancement New feature or request queue workers Ones taking the FI and doing the FO Reporting Errors, Logs, etc.
Projects
None yet
Development

No branches or pull requests

2 participants