Skip to content

Commit

Permalink
Merge pull request #1179 from OPUS4/v4.8.0.4
Browse files Browse the repository at this point in the history
Release OPUS 4.8.0.4
  • Loading branch information
j3nsch authored Jan 9, 2024
2 parents 61d55fb + 30350b2 commit 666e90e
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# OPUS 4 Change Log

## Release 4.8.0.4 - 2024-01-09

https://github.com/OPUS4/application/issues/1174
https://github.com/OPUS4/application/issues/1176

## Release 4.8.0.3 - 2023-11-28

https://github.com/OPUS4/application/issues/1159
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ redevelopment that was created as part of a DFG ([Deutsche Forschungsgemeinschaf
Since then the development has been continued at KOBV ([Kooperativer Bibliotheksverbund Berlin-Brandenburg][KOBV])
mostly.

## OPUS 4.8.0.3(current version)
## OPUS 4.8.0.4 (current version)

The current version of OPUS 4 is __4.8.0.3__. It is available on the [master][MASTER] branch and compatible with
The current version of OPUS 4 is __4.8.0.4__. It is available on the [master][MASTER] branch and compatible with
PHP 7.1 to 8.1.

[Documentation][DOC]
Expand Down
23 changes: 23 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# OPUS 4 Release Notes

## Patch Release 4.8.0.4 - 2024-01-09

Fehler beim Löschen mehrerer Dateien von einem Dokument behoben.
https://github.com/OPUS4/application/issues/1174

### Review-Modul

Beim Freischalten im Review-Modul, bekommt die Rolle **guest** automatisch
Zugriff auf die Dateien, der freigeschalteten Dokumente. Das kann nun mit
einer neuen Option (`workflow.stateChange.published.addGuestAccess = 0`)
abgeschaltet werden.
https://github.com/OPUS4/application/issues/1176

In der Standardkonfiguration ist die Option aktiviert, um in einem Patch
Release, das Verhalten von OPUS 4 nicht zu verändern. In einer kommenden
Version wird sich der Defaultwert vermutlich ändern.

Die Zugriffsrechte auf die Dateien werden beim Freischalten einzelner
Dokumente in der Administration nicht verändert, unabhängig von der neuen
Option. Das Verhalten der verschiedenen Möglichkeiten zur Freigabe wird in
Zukunft vereinheitlicht werden.
https://github.com/OPUS4/application/issues/1177

## Patch Release 4.8.0.3 - 2023-11-28

Das `bin/opus4` Kommandozeilentool wurde um zwei Kommandos erweitert.
Expand Down
5 changes: 4 additions & 1 deletion application/configs/application.ini
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ name = 'OPUS 4'
logoLink = home
security = 1
workspacePath = APPLICATION_PATH "/workspace"
version = 4.8.0.3
version = 4.8.0.4
update.latestVersionCheckUrl = "https://api.github.com/repos/opus4/application/releases/latest"

; Determines the implementation of the OPUS 4 data model
Expand Down Expand Up @@ -582,6 +582,9 @@ crossref.mailTo = ''
; path to the licences directory that stores licence logos
licences.logos.path = APPLICATION_PATH "/public/img/licences"

; Workflow settings
workflow.stateChange.published.addGuestAccess = 1

; Staging, Testing and Development configurations =====================================================================

[staging : production]
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/models/FileImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function deleteFile($docId, $fileId)
$files = $doc->getFile();

foreach ($files as $index => $file) {
if ($file->getId() !== $fileId) {
if ($file->getId() !== (int) $fileId) {
$keepFiles[] = $file;
}
}
Expand Down
21 changes: 17 additions & 4 deletions modules/review/models/ClearDocumentsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
/**
* Contains code for clearing documents (switching to published state).
*/
class Review_Model_ClearDocumentsHelper
class Review_Model_ClearDocumentsHelper extends Application_Model_Abstract
{
/**
* Publishes documents and adds the given Person as referee.
Expand Down Expand Up @@ -67,9 +67,11 @@ public function clear(?array $docIds = null, $userId = null, $person = null)
$document->setPublishedDate($date);
}

$guestRole = UserRole::fetchByName('guest');
foreach ($document->getFile() as $file) {
$guestRole->appendAccessFile($file->getId());
if ($this->isAddGuestAccessEnabled()) {
$guestRole = UserRole::fetchByName('guest');
foreach ($document->getFile() as $file) {
$guestRole->appendAccessFile($file->getId());
}
}

if (isset($person)) {
Expand All @@ -86,6 +88,17 @@ public function clear(?array $docIds = null, $userId = null, $person = null)
}
}

/**
* @return bool
*/
public function isAddGuestAccessEnabled()
{
$config = $this->getConfig();

return ! isset($config->workflow->stateChange->published->addGuestAccess) ||
filter_var($config->workflow->stateChange->published->addGuestAccess, FILTER_VALIDATE_BOOLEAN);
}

/**
* Rejects documents and adds the given Person as referee.
*
Expand Down
5 changes: 5 additions & 0 deletions tests/modules/admin/controllers/FilemanagerControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,4 +384,9 @@ public function testDocumentFilesWithoutSortOrder()
$positionFile2 = strpos($body, 'datei mit unüblichem Namen.xhtml');
$this->assertTrue($positionFile1 < $positionFile2);
}

public function testRemovingMultipleFilesWorks()
{
$this->markTestIncomplete('Test for https://github.com/OPUS4/application/issues/1174');
}
}
32 changes: 32 additions & 0 deletions tests/modules/review/models/ClearDocumentsHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,36 @@ public function testPublishedDateIsNotOverwritten()
$this->assertNotNull($publishedDate);
$this->assertEquals(0, $expectedDate->compare($publishedDate)); // still yesterday
}

public function testIsAddGuestAccessEnabled()
{
$helper = new Review_Model_ClearDocumentsHelper();

$this->assertTrue($helper->isAddGuestAccessEnabled());
}

public function testIsAddGuestAccessEnabledNotConfigured()
{
$config = $this->getConfig();

unset($config->workflow->stateChange->published);

$this->assertFalse(isset($config->workflow->stateChange->published->addGuestAccess));

$helper = new Review_Model_ClearDocumentsHelper();
$helper->setConfig($config);

$this->assertTrue($helper->isAddGuestAccessEnabled());
}

public function testIsAddGuestAccessEnabledFalse()
{
$this->adjustConfiguration([
'workflow' => ['stateChange' => ['published' => ['addGuestAccess' => 0]]],
]);

$helper = new Review_Model_ClearDocumentsHelper();

$this->assertFalse($helper->isAddGuestAccessEnabled());
}
}

0 comments on commit 666e90e

Please sign in to comment.