Skip to content

Commit e7ca0c7

Browse files
committed
MCR-3551 allow hiding of publicly available derivates
1 parent d45c241 commit e7ca0c7

File tree

12 files changed

+225
-73
lines changed

12 files changed

+225
-73
lines changed

mir-module/src/main/java/org/mycore/mir/authorization/MIRStrategy.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.mycore.common.MCRCache;
2828
import org.mycore.common.MCRException;
2929
import org.mycore.common.config.MCRConfiguration2;
30+
import org.mycore.common.xml.MCRXMLFunctions;
3031
import org.mycore.datamodel.classifications2.MCRCategLinkReference;
3132
import org.mycore.datamodel.classifications2.MCRCategLinkService;
3233
import org.mycore.datamodel.classifications2.MCRCategoryID;
@@ -162,11 +163,12 @@ private boolean checkDerivatePermission(MCRObjectID derivateId, String permissio
162163
return OBJECT_BASE_STRATEGY.checkPermission(permissionId, permission);
163164
}
164165

165-
// 1. check if the object has a assigned identifier
166+
// 1. check if the object has an assigned identifier and the derivate is exported
166167
if (MCRAccessManager.PERMISSION_WRITE.equalsIgnoreCase(permission) ||
167168
MCRAccessManager.PERMISSION_DELETE.equalsIgnoreCase(permission)) {
168169
final boolean hasRegisteredPI = hasRegisteredPI(objectId);
169-
if (hasRegisteredPI && !canEditPI()) {
170+
final boolean isExported = MCRXMLFunctions.isDerivateDisplayEnabled(derivateId.toString(), "export");
171+
if (hasRegisteredPI && isExported && !canEditPI()) {
170172
return false;
171173
}
172174
}

mir-module/src/main/resources/META-INF/resources/editor/editor-derivate-includes.xed

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" encoding="ISO-8859-1"?>
22

3-
<xed:template xmlns:xed="http://www.mycore.de/xeditor" xmlns:mir="http://www.mycore.de/mir">
3+
<xed:template xmlns:xed="http://www.mycore.de/xeditor" xmlns:mir="http://www.mycore.de/mir"
4+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5+
6+
<xsl:param name="MIR.Editor.Derivate.EditableIntentServiceFlags" select="en"/>
47

58
<xed:template id="in.out">
69
<xed:source uri="notnull:checkPermissionChain:{$derivateid}:writedb:xslStyle:editor/derivate2xeditor:mcrobject:{$derivateid}" />
@@ -52,6 +55,114 @@
5255
</xed:bind>
5356
</xed:template>
5457

58+
<xed:template id="flags">
59+
<xed:if test="$MIR.Editor.Derivate.EditableIntentServiceFlags != 'false'">
60+
<div class="mir-form-group row">
61+
<label class="col-md-3 col-form-label text-end d-inline form-label">
62+
<xed:output i18n="mir.flags"/>
63+
</label>
64+
<div class="col-md-2">
65+
<xed:bind xpath="service/servflags/servflag[@type='intent-show-file-viewer']">
66+
<xed:choose>
67+
<xed:when test="xed:call-java('org.mycore.access.MCRAccessManager','checkPermission',$derivateid,'manage-intent-show-file-viewer')">
68+
<select class="form-control form-control-inline form-select">
69+
<option value="">
70+
<xed:output i18n="mir.flags.intent.default"/>
71+
</option>
72+
<option value="false">
73+
<xed:output i18n="component.viewer.modal.no"/>
74+
</option>
75+
<option value="true">
76+
<xed:output i18n="component.viewer.modal.yes"/>
77+
</option>
78+
</select>
79+
</xed:when>
80+
<xed:otherwise>
81+
<select class="form-control form-control-inline form-select" disabled="disabled">
82+
<option value="">
83+
<xed:output i18n="mir.flags.intent.default"/>
84+
</option>
85+
<option value="false">
86+
<xed:output i18n="component.viewer.modal.no"/>
87+
</option>
88+
<option value="true">
89+
<xed:output i18n="component.viewer.modal.yes"/>
90+
</option>
91+
</select>
92+
</xed:otherwise>
93+
</xed:choose>
94+
</xed:bind>
95+
</div>
96+
<div class="col-md-2">
97+
<xed:bind xpath="service/servflags/servflag[@type='intent-show-file-area']">
98+
<xed:choose>
99+
<xed:when test="xed:call-java('org.mycore.access.MCRAccessManager','checkPermission',$derivateid,'manage-intent-show-file-area')">
100+
<select class="form-control form-control-inline form-select">
101+
<option value="">
102+
<xed:output i18n="mir.flags.intent.default"/>
103+
</option>
104+
<option value="false">
105+
<xed:output i18n="component.viewer.modal.no"/>
106+
</option>
107+
<option value="true">
108+
<xed:output i18n="component.viewer.modal.yes"/>
109+
</option>
110+
</select>
111+
</xed:when>
112+
<xed:otherwise>
113+
<select class="form-control form-control-inline form-select" disabled="disabled">
114+
<option value="">
115+
<xed:output i18n="mir.flags.intent.default"/>
116+
</option>
117+
<option value="false">
118+
<xed:output i18n="component.viewer.modal.no"/>
119+
</option>
120+
<option value="true">
121+
<xed:output i18n="component.viewer.modal.yes"/>
122+
</option>
123+
</select>
124+
</xed:otherwise>
125+
</xed:choose>
126+
</xed:bind>
127+
</div>
128+
<div class="col-md-2">
129+
<xed:bind xpath="service/servflags/servflag[@type='intent-export']">
130+
<xed:choose>
131+
<xed:when test="xed:call-java('org.mycore.access.MCRAccessManager','checkPermission',$derivateid,'manage-intent-export')">
132+
<select class="form-control form-control-inline form-select">
133+
<option value="">
134+
<xed:output i18n="mir.flags.intent.default"/>
135+
</option>
136+
<option value="false">
137+
<xed:output i18n="component.viewer.modal.no"/>
138+
</option>
139+
<option value="true">
140+
<xed:output i18n="component.viewer.modal.yes"/>
141+
</option>
142+
</select>
143+
</xed:when>
144+
<xed:otherwise>
145+
<select class="form-control form-control-inline form-select" disabled="disabled">
146+
<option value="">
147+
<xed:output i18n="mir.flags.intent.default"/>
148+
</option>
149+
<option value="false">
150+
<xed:output i18n="component.viewer.modal.no"/>
151+
</option>
152+
<option value="true">
153+
<xed:output i18n="component.viewer.modal.yes"/>
154+
</option>
155+
</select>
156+
</xed:otherwise>
157+
</xed:choose>
158+
</xed:bind>
159+
</div>
160+
<mir:help-pmud help-text="{i18n:mir.help.derivate.flags}" pmud="false" />
161+
</div>
162+
<xed:cleanup-rule xpath="//service/servflags/servflag[starts-with(@type,'intent-')]" relevant-if="string-length(text()) &gt; 0"/>
163+
</xed:if>
164+
</xed:template>
165+
55166
<xed:template id="title_repeat">
56167
<xed:repeat xpath="derivate/titles[@class='MCRMetaLangText'][@heritable='false'][1]/title">
57168
<div class="mir-form-group row">

mir-module/src/main/resources/META-INF/resources/editor/editor-derivate.xed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
ref="derivate_types"/>
2828
<xed:include uri="xslStyle:editor/mir2xeditor:webapp:editor/editor-derivate-includes.xed"
2929
ref="mir_access"/>
30+
<xed:if></xed:if>
31+
<xed:include uri="xslStyle:editor/mir2xeditor:webapp:editor/editor-derivate-includes.xed"
32+
ref="flags"/>
3033
<xed:include uri="webapp:editor/editor-derivate-includes.xed" ref="cancel.submit"/>
3134
</div>
3235
</xed:bind>

mir-module/src/main/resources/config/mir/deprecated.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ MIR.OAS.GraphProviderURL=MIR.ePuSta.GraphProviderURL
33
MIR.OAS.Prefix=MIR.ePuSta.Prefix
44
MIR.Strategy.AccessKey.ObjectTypes=MCR.ACL.AccessKey.Strategy.AllowedObjectTypes
55
MCR.Access.Strategy.SubmittedCategory=MCR.Access.Strategy.SubmittedCategories
6+
MIR.Viewer.DisableDerivateType=MCR.Derivate.DisplayFilter.Filter.Filters.20.Mappings.show-file-viewer

mir-module/src/main/resources/config/mir/messages_de.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ mir.export.format.wordbib =
378378
mir.export.format.wordbib.description = wird von Microsoft Office Word ab Version 2007 verwendet, um Literaturverzeichnisse zu verwalten.
379379
mir.export.more = (mehr)
380380
mir.extent = Umfang:
381+
mir.flags = Vorschau / Dateiliste / Export
382+
mir.flags.intent.default = Standard
381383
mir.form.editor.dynamic.header = Eingabeformular f\u00FCr
382384
mir.form.editor.dynamic.header.in = in
383385
mir.form.editor.dynamic.partof = Erschienen in
@@ -422,6 +424,7 @@ mir.help.date.submitted =
422424
mir.help.date.submitted.range = Datum oder Zeitraum der Einreichung. Das Datum muss im ISO Format mit Bindestrich YYYY-MM-DD, YYYY-MM oder YYYY\r\nangegeben werden.\r\n<br />\r\nBeispiel: 2003-01-27 oder 2010 oder 2009-01
423425
mir.help.date.updated = Datum der Aktualisierung. Das Datum muss im ISO Format mit Bindestrich YYYY-MM-DD, YYYY-MM oder YYYY\r\nangegeben werden.\r\n<br />\r\nBeispiel: 2003-01-27 oder 2010 oder 2009-01
424426
mir.help.date.updated.range = Datum oder Zeitraum der Aktualisierung. Das Datum muss im ISO Format mit Bindestrich YYYY-MM-DD, YYYY-MM oder YYYY\r\nangegeben werden.\r\n<br />\r\nBeispiel: 2003-01-27 oder 2010 oder 2009-01
427+
mir.help.derivate.flags = Einstellung, ob Nutzenden, die diesen Dateibereich sehen d\u00FCrfen, eine Vorschau bzw. die Dateiliste angezeigt werden soll (die Dateiliste wird jedoch immer angezeigt, wenn dieser Dateibereich auch geschrieben werden darf) bzw. ob dieser Dateibereich in Dateiexporten (verlinkt in den HTML- und OAI-Metadaten) ber\u00FCcksichtigt werden soll. Die Option 'Standard' f\u00FChrt zu einem Standardverhalten, basierend auf dem Typ des Dateibereichs.
425428
mir.help.derivate.label = Technische Beschriftung f\u00FCr die interne Verwendung.
426429
mir.help.derivate.title = Beschriftung f\u00FCr die Darstellung auf der Webseite in Abh\u00E4ngigkeit von der Sprache.
427430
mir.help.doi.handle.urn = Falls bereits eine DOI, ein Handle oder eine URN f\u00FCr Ihren Beitrag vergeben wurde, ist dieser persistente Identifikator hier anzugeben.

mir-module/src/main/resources/config/mir/messages_en.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ mir.export.format.wordbib =
366366
mir.export.format.wordbib.description = is used by Microsoft Office Word 2007 or later, to manage bibliographic references.
367367
mir.export.more = (more)
368368
mir.extent = Extent:
369+
mir.flags = Preview / File listing / Export
370+
mir.flags.intent.default = Default
369371
mir.form.editor.dynamic.header = Submission form for
370372
mir.form.editor.dynamic.header.in = in
371373
mir.form.editor.dynamic.partof = Part of
@@ -409,6 +411,7 @@ mir.help.date.submitted =
409411
mir.help.date.submitted.range = Date or period of submission. The date must be in the ISO format with hyphen YYYY-MM-DD, YYYY-MM or YYYY be specified.\r\n<br />\r\nExample: 2003-01-27 or 2010 or 2009-01
410412
mir.help.date.updated = Date of the update. The date must be in the ISO format with hyphen YYYY-MM-DD, YYYY-MM or YYYY be specified.\r\n<br />\r\nExample: 2003-01-27 or 2010 or 2009-01
411413
mir.help.date.updated.range = Date or period of the update. The date must be in the ISO format with hyphen YYYY-MM-DD, YYYY-MM or YYYY be specified.\r\n<br />\r\nExample: 2003-01-27 or 2010 or 2009-01
414+
mir.help.derivate.flags = Setting whether users who are allowed to see this file area should be shown a preview or the file list (however, the file list is always displayed if this file area is allowed to be written to) or whether this file area should be taken into account in file exports (linked in the HTML and OAI metadata). The 'Default' option results in default behavior based on the derivate type.
412415
mir.help.derivate.label = Technical label for internal use.
413416
mir.help.derivate.title = Label presented on website in depend of language.
414417
mir.help.doi.handle.urn = If a persistent identifier (e.g. DOI, URN) has been assigned to this dataset already, please enter it here.

mir-module/src/main/resources/config/mir/mycore.properties

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ MCR.classbrowser.folder.closed=far fa-plus-square
215215
MCR.classbrowser.folder.open=far fa-minus-square
216216
MCR.classbrowser.folder.leaf=far fa-square
217217

218-
MCR.classeditor.additionalLanguages=x-access,x-auth,x-bibl,x-disable,x-display,x-dnb-cc,x-dnb-other,x-export,x-group,x-hosts,x-group,x-logo,x-mapping,x-miless,x-source,x-term,x-uri
218+
MCR.classeditor.additionalLanguages=x-access,x-auth,x-bibl,x-disable,x-display,x-dnb-cc,x-dnb-other,x-group,x-hosts,x-group,x-logo,x-mapping,x-miless,x-source,x-term,x-uri
219219

220220
##############################################################################
221221
# Additional Events #
@@ -320,6 +320,30 @@ MIR.xMetaDissPlus.diniPublType.classificationId=diniPublType2022
320320
MIR.xMetaDissPlus.rights.rightsReserved2free=true
321321
MIR.xMetaDissPlus.person.termsOfAddress2academicTitle=false
322322

323+
324+
##############################################################################
325+
# Website #
326+
##############################################################################
327+
328+
# include form fields do set intent-flags in derivate editor and
329+
# enable intent-flag-based override of derivate-type-based intent-mapping
330+
MIR.Editor.Derivate.EditableIntentServiceFlags=false
331+
332+
MCR.Derivate.DisplayFilter.Class=org.mycore.common.xml.derivate.MCRTranslatingDerivateDisplayFilter
333+
MCR.Derivate.DisplayFilter.Translations.compress=export
334+
MCR.Derivate.DisplayFilter.Translations.enhance=export
335+
MCR.Derivate.DisplayFilter.Filter.Class=org.mycore.common.xml.derivate.MCRCombinedDerivateDisplayFilter
336+
MCR.Derivate.DisplayFilter.Filter.Filters.10.Class=org.mycore.common.xml.derivate.MCRServiceFlagDerivateDisplayFilter
337+
MCR.Derivate.DisplayFilter.Filter.Filters.10.Enabled=%MIR.Editor.Derivate.EditableIntentServiceFlags%
338+
MCR.Derivate.DisplayFilter.Filter.Filters.20.Class=org.mycore.common.xml.derivate.MCRDerivateTypeDerivateDisplayFilter
339+
MCR.Derivate.DisplayFilter.Filter.Filters.20.Mappings.show-file-viewer.thumbnail=true
340+
MCR.Derivate.DisplayFilter.Filter.Filters.20.Mappings.show-file-viewer.toc=false
341+
MCR.Derivate.DisplayFilter.Filter.Filters.20.Mappings.show-file-area.thumbnail=false
342+
MCR.Derivate.DisplayFilter.Filter.Filters.20.Mappings.show-file-area.toc=false
343+
MCR.Derivate.DisplayFilter.Filter.Filters.20.Mappings.export.thumbnail=false
344+
MCR.Derivate.DisplayFilter.Filter.Filters.20.Mappings.export.toc=false
345+
346+
323347
##############################################################################
324348
# Support for Podcasts #
325349
##############################################################################
@@ -755,7 +779,7 @@ MIR.Layout.Display.Div=mir-edit,mir-abstract-badges
755779
MIR.Layout.Abstract.Type.Classification=
756780

757781
MIR.NotFullAccessInfo.Genres=
758-
MIR.Viewer.DisableDerivateType=thumbnail
782+
759783
##############################################################################
760784
# Canonical link for any metadata frontpage #
761785
##############################################################################

0 commit comments

Comments
 (0)