Oh, bother. You’re right, I don’t see that section in my own mets file either 
and I now have vague memories of when I first discovered its absence. Sadly the 
memories are so vague I can’t remember if I found a solution so that we could 
see that metadata, or if I just worked ‘blind’ taking on faith that the data 
was still there somewhere, just invisible.  I may have at least found the 
metadata structure somewhere via a websearch so that I knew where it *ought* to 
be.

Deborah

From: dspace-tech@googlegroups.com <dspace-tech@googlegroups.com> On Behalf Of 
euler
Sent: Wednesday, 29 July 2020 7:24 PM
To: DSpace Technical Support <dspace-tech@googlegroups.com>
Subject: Re: [dspace-tech] How to check if bitstream is readable by a specific 
group

Hi Deborah,

Thank you for the swift response! I found out that the variables you mentioned 
are also being used in the display-rights template. However, when I looked at 
the mets file, there is no mets:amdSec/mets:rightsMD. I looked in the Demo 
DSpace site 
(demo.dspace.org<http://demo.dspace.org/xmlui/metadata/handle/10673/5/mets.xml>)
 and there is also no mets:amdSec in its mets file. Is there a setting that I 
need to enable to make the 'mets:amdSec/mets:rightsMD' appear in the mets file? 
I just assumed that the template 'display-rights' was not used in the Mirage2 
version of DSpace 6.3.

For my case example, this is one mets file where the bitstream is readable by 
the group AQD: 
https://repository.seafdec.org.ph/metadata/handle/10862/2142/mets.xml<https://repository.seafdec.org.ph/metadata/handle/10862/2142/mets.xml>

Thanks again in advance and best regards!
euler

On Wednesday, July 29, 2020 at 11:44:13 AM UTC+8, Fitchett, Deborah wrote:
Hi,

Yes, you can do this – at least in 5.8 XMLUI Mirage2 we are.

We’ve first got variables:
<xsl:variable name="file_id" 
select="jstring:replaceAll(jstring:replaceAll(string(@ADMID), '_METSRIGHTS', 
''), 'rightsMD_', '')"/>
<xsl:variable name="rights_declaration" 
select="../../../mets:amdSec/mets:rightsMD[@ID = concat('rightsMD_', $file_id, 
'_METSRIGHTS')]/mets:mdWrap/mets:xmlData/rights:RightsDeclarationMD"/>
<xsl:variable name="rights_context" 
select="$rights_declaration/rights:Context"/>
<xsl:variable name="users">
      <xsl:for-each select="$rights_declaration/*">
           <xsl:value-of select="rights:UserName"/>
           <xsl:choose>
                 <xsl:when test="rights:UserName/@USERTYPE = 'GROUP'">
                    <xsl:text> (group)</xsl:text>
                 </xsl:when>
                 <xsl:when test="rights:UserName/@USERTYPE = 'INDIVIDUAL'">
                    <xsl:text> (individual)</xsl:text>
                 </xsl:when>
           </xsl:choose>
           <xsl:if test="position() != last()">, </xsl:if>
      </xsl:for-each>
</xsl:variable>

Then we can do a test like:
<xsl:when test="$users='AQD (group)'">

Other things we test for are whether any embargo has expired:
test="$rights_context/@in-effect)='true'"

and whether it’s available for the current user:
test="contains(mets:FLocat[@LOCTYPE='URL']/@xlink:href,'isAllowed=y')"

If you need to troubleshoot you can see the raw METS xml at eg
https://example.com/metadata/handle/12345/1234/mets.xml<https://example.com/metadata/handle/12345/1234/mets.xml>

Deborah


From: dspac...@googlegroups.com<javascript:> 
<dspac...@googlegroups.com<javascript:>> On Behalf Of euler
Sent: Wednesday, 29 July 2020 2:10 PM
To: DSpace Technical Support <dspac...@googlegroups.com<javascript:>>
Subject: [dspace-tech] How to check if bitstream is readable by a specific group

Dear All,

We are using DSpace 6.3 XMLUI Mirage2 theme. I have enabled IP based 
authentication in which all users coming from our internal network will 
automatically become members of a special group (AQD). What I want to achieve 
is to display a logo beside the bitstream link to identify it as downloadable 
only for the group AQD. Looking at the item-view.xsl, I see that the lock 
glyphicon is rendered if the bistream URL contains the 'isAllowed=n' text. I 
cannot use that logic because not all restricted bitstreams are readable by the 
group AQD (some are for Admins only). Is there a way using just xslt to check 
whether the bitstream is readable by a specific group?

Thanks in advance!
euler
--
All messages to this mailing list should adhere to the DuraSpace Code of 
Conduct: 
https://duraspace.org/about/policies/code-of-conduct/<https://duraspace.org/about/policies/code-of-conduct/>
---
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspac...@googlegroups.com<javascript:>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/685deb8c-208a-4590-811b-898d2ae71542o%40googlegroups.com<https://groups.google.com/d/msgid/dspace-tech/685deb8c-208a-4590-811b-898d2ae71542o%40googlegroups.com?utm_medium=email&utm_source=footer>.

________________________________

"The contents of this e-mail (including any attachments) may be confidential 
and/or subject to copyright. Any unauthorised use, distribution, or copying of 
the contents is expressly prohibited. If you have received this e-mail in 
error, please advise the sender by return e-mail or telephone and then delete 
this e-mail together with all attachments from your system."
--
All messages to this mailing list should adhere to the DuraSpace Code of 
Conduct: 
https://duraspace.org/about/policies/code-of-conduct/<https://duraspace.org/about/policies/code-of-conduct/>
---
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
dspace-tech+unsubscr...@googlegroups.com<mailto:dspace-tech+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/24abc41c-b555-4531-afe8-571ccd865fefo%40googlegroups.com<https://groups.google.com/d/msgid/dspace-tech/24abc41c-b555-4531-afe8-571ccd865fefo%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
All messages to this mailing list should adhere to the DuraSpace Code of 
Conduct: https://duraspace.org/about/policies/code-of-conduct/
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/ME2PR01MB47723A9136F286609541A17BC5710%40ME2PR01MB4772.ausprd01.prod.outlook.com.

Reply via email to