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, [], [], [], [],
false);
69 $eligible_copyright_entry_ids,
70 $is_copyright_eligible
76 return $this->
access->checkAccess(
'write',
'', $ref_id, $type, $obj_id) &&
78 $this->publishing_settings->isManualPublishingEnabled() ||
79 $this->publishing_settings->isAutomaticPublishingEnabled()
81 in_array($type, $this->publishing_settings->getObjectTypesEligibleForPublishing());
86 if ($this->exposed_repo->doesUndeletedRecordExistForObjID($obj_id)) {
89 if ($this->status_repo->isAlreadyHarvested($obj_id)) {
90 return Status::UNDER_REVIEW;
92 if ($this->status_repo->isHarvestingBlocked($obj_id)) {
93 return Status::BLOCKED;
95 return Status::UNPUBLISHED;
103 $statuses = [Status::UNPUBLISHED];
104 if ($this->publishing_settings->isAutomaticPublishingEnabled()) {
105 $statuses[] = Status::BLOCKED;
107 if ($this->publishing_settings->isEditorialStepEnabled()) {
108 $statuses[] = Status::UNDER_REVIEW;
122 case Status::UNPUBLISHED:
123 if ($this->publishing_settings->isAutomaticPublishingEnabled()) {
124 $actions[] = Action::BLOCK;
126 if (!$this->publishing_settings->isManualPublishingEnabled()) {
129 if ($this->publishing_settings->isEditorialStepEnabled()) {
130 $actions[] = Action::SUBMIT;
132 $actions[] = Action::PUBLISH;
136 case Status::BLOCKED:
137 $actions[] = Action::UNBLOCK;
140 case Status::UNDER_REVIEW:
141 if ($this->isReferenceInEditorialCategory(
$ref_id)) {
142 $actions[] = Action::ACCEPT;
145 $actions[] = Action::WITHDRAW;
150 $actions[] = Action::WITHDRAW;
157 if (!$this->publishing_settings->isEditorialStepEnabled()) {
160 return $this->repo_object_handler->isReferenceInContainer(
162 $this->publishing_settings->getContainerRefIDForEditorialStep()
171 return $this->publishing_settings->getCopyrightEntryIDsSelectedForPublishing();
183 array $relevant_actions,
184 bool $is_copyright_eligible
186 $unavailable_actions = [];
187 foreach ($relevant_actions as $action) {
188 $available = match ($action) {
189 Action::BLOCK => $this->state_changer->checkPermissionsForBlock(
$ref_id, $type, $obj_id),
190 Action::UNBLOCK => $this->state_changer->checkPermissionsForUnblock(
$ref_id, $type, $obj_id),
192 $this->state_changer->checkPermissionsForPublish(
$ref_id, $type, $obj_id) &&
193 $is_copyright_eligible,
194 Action::WITHDRAW => $this->state_changer->checkPermissionsForWithdraw(
$ref_id, $type, $obj_id),
196 $this->state_changer->checkPermissionsForSubmit(
$ref_id, $type, $obj_id) &&
197 $is_copyright_eligible,
198 Action::ACCEPT => $this->state_changer->checkPermissionsForAccept(
$ref_id, $type, $obj_id),
202 $unavailable_actions[] = $action;
205 return $unavailable_actions;
211 array $eligible_copyright_entry_ids
213 $copyright_path = $this->path_factory
215 ->withNextStep(
'rights')
216 ->withNextStep(
'description')
217 ->withNextStep(
'string')
219 $set = $this->
repository->getMD($obj_id, $obj_id, $type);
220 $copyright_string = $this->navigator_factory->navigator($copyright_path, $set->getRoot())
221 ->lastElementAtFinalStep()
224 if (!$this->copyright_identifier_handler->isIdentifierValid($copyright_string)) {
227 $entry_id = $this->copyright_identifier_handler->parseEntryIDFromIdentifier($copyright_string);
228 if (!in_array($entry_id, $eligible_copyright_entry_ids)) {
Class ilAccessHandler Checks access for ILIAS objects.