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

Deborah


From: [email protected] <[email protected]> On Behalf Of 
euler
Sent: Wednesday, 29 July 2020 2:10 PM
To: DSpace Technical Support <[email protected]>
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 
[email protected]<mailto:[email protected]>.
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/
--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/ME2PR01MB47726AC8B5630E4F2AAF4937C5700%40ME2PR01MB4772.ausprd01.prod.outlook.com.

Reply via email to