19declare(strict_types=1);
38 protected ExposedRecordsRepository $exposed_repo,
39 protected ResourceStatusRepository $status_repo,
40 protected PublishingSettings $publishing_settings,
41 protected RepoObjectHandler $repo_object_handler,
42 protected CopyrightIdentifierHandler $copyright_identifier_handler,
46 protected PathFactory $path_factory
56 if (!$is_publishing_relevant) {
57 return new StateInfo(
false, Status::UNPUBLISHED, [], [], [], []);
67 $this->
getUnavailableActions($ref_id, $type, $obj_id, $relevant_actions, $eligible_copyright_entry_ids),
68 $eligible_copyright_entry_ids
74 return $this->
access->checkAccess(
'write',
'', $ref_id, $type, $obj_id) &&
76 $this->publishing_settings->isManualPublishingEnabled() ||
77 $this->publishing_settings->isAutomaticPublishingEnabled()
79 in_array($type, $this->publishing_settings->getObjectTypesEligibleForPublishing());
84 if ($this->exposed_repo->doesUndeletedRecordExistForObjID($obj_id)) {
87 if ($this->status_repo->isAlreadyHarvested($obj_id)) {
88 return Status::UNDER_REVIEW;
90 if ($this->status_repo->isHarvestingBlocked($obj_id)) {
91 return Status::BLOCKED;
93 return Status::UNPUBLISHED;
101 $statuses = [Status::UNPUBLISHED];
102 if ($this->publishing_settings->isAutomaticPublishingEnabled()) {
103 $statuses[] = Status::BLOCKED;
105 if ($this->publishing_settings->isEditorialStepEnabled()) {
106 $statuses[] = Status::UNDER_REVIEW;
120 case Status::UNPUBLISHED:
121 if ($this->publishing_settings->isAutomaticPublishingEnabled()) {
122 $actions[] = Action::BLOCK;
124 if (!$this->publishing_settings->isManualPublishingEnabled()) {
127 if ($this->publishing_settings->isEditorialStepEnabled()) {
128 $actions[] = Action::SUBMIT;
130 $actions[] = Action::PUBLISH;
134 case Status::BLOCKED:
135 $actions[] = Action::UNBLOCK;
138 case Status::UNDER_REVIEW:
139 if ($this->isReferenceInEditorialCategory(
$ref_id)) {
140 $actions[] = Action::ACCEPT;
143 $actions[] = Action::WITHDRAW;
148 $actions[] = Action::WITHDRAW;
155 if (!$this->publishing_settings->isEditorialStepEnabled()) {
158 return $this->repo_object_handler->isReferenceInContainer(
160 $this->publishing_settings->getContainerRefIDForEditorialStep()
169 return $this->publishing_settings->getCopyrightEntryIDsSelectedForPublishing();
181 array $relevant_actions,
182 array $eligible_copyright_entry_ids
184 $unavailable_actions = [];
185 foreach ($relevant_actions as $action) {
186 $available = match ($action) {
187 Action::BLOCK => $this->state_changer->checkPermissionsForBlock(
$ref_id, $type, $obj_id),
188 Action::UNBLOCK => $this->state_changer->checkPermissionsForUnblock(
$ref_id, $type, $obj_id),
190 $this->state_changer->checkPermissionsForPublish(
$ref_id, $type, $obj_id) &&
191 $this->isCopyrightEligibleForPublishing($obj_id, $type, $eligible_copyright_entry_ids),
192 Action::WITHDRAW => $this->state_changer->checkPermissionsForWithdraw(
$ref_id, $type, $obj_id),
194 $this->state_changer->checkPermissionsForSubmit(
$ref_id, $type, $obj_id) &&
195 $this->isCopyrightEligibleForPublishing($obj_id, $type, $eligible_copyright_entry_ids),
196 Action::ACCEPT => $this->state_changer->checkPermissionsForAccept(
$ref_id, $type, $obj_id),
200 $unavailable_actions[] = $action;
203 return $unavailable_actions;
209 array $eligible_copyright_entry_ids
211 $copyright_path = $this->path_factory
213 ->withNextStep(
'rights')
214 ->withNextStep(
'description')
215 ->withNextStep(
'string')
217 $set = $this->
repository->getMD($obj_id, $obj_id, $type);
218 $copyright_string = $this->navigator_factory->navigator($copyright_path, $set->getRoot())
219 ->lastElementAtFinalStep()
222 if (!$this->copyright_identifier_handler->isIdentifierValid($copyright_string)) {
225 $entry_id = $this->copyright_identifier_handler->parseEntryIDFromIdentifier($copyright_string);
226 if (!in_array($entry_id, $eligible_copyright_entry_ids)) {
Class ilAccessHandler Checks access for ILIAS objects.