WIP: Adds run operation for harvest plan entities#4591
Draft
Conversation
paul-m
commented
Oct 30, 2025
| }; | ||
| protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { | ||
| if ($admin_permission = $this->entityType->getAdminPermission()) { | ||
| return AccessResult::allowedIfHasPermission($account, $admin_permission); |
Contributor
Author
There was a problem hiding this comment.
Oof. This is clearly wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes [issue#]
This is basically a proof-of-concept where I teach myself how to wire up entity operations.
Todo:
Prettify the harvest_run entity display.
Handle a bunch of error cases.
Discoveries:
Harvests can be 'reverted', which unpublishes the dataset nodes in various ways. This is different from reverting an entity revision, which is where you go back to old content from a previous edit. Drupal's entity system wants us to use 'revert' to mean the latter rather than the former. I got it working by callling it a rollback instead, but that's probably up for discussion.
Many permissions use an '[operation] [entity]' name, such as 'edit node', but the entity access system wants permissions to have a name like '[entity].[operation]', such as 'harvest_plan.run'. We'll need to rename permissions somewhere.
Demo:
Make a local.
Enable and create sample content.
Visit the harvest page: https://dkan.ddev.site/admin/dkan/harvest
Click 'Run' on the sample_content harvest.
Confirm that you want to run the harvest.
Be redirected to the very ugly entity page for a harvest run entity.
Describe your changes
QA Steps
Checklist before requesting review
If any of these are left unchecked, please provide an explanation