We would like to remove an item's abstract from the item view (and in the metadata in the HTML source) while an item is under embargo. Can we use some of the code that selects the 'lock' thumbnail to achieve this?
Your assumption is correct, you can query the same information that is used to display the lock icon to control your metadata display. The information is a bit ugly to retrieve, but it is there.
I have extracted some code that might be helpful. I actually use this to customize thumbnail display, but the concept will be similar in your case.
<!-- Get the current item handle -->
<xsl:variable name="HANDLE" select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='request'][@qualifier='URI']"/>
<!-- Generate the URL to the rights information for the item -->
<xsl:variable name="EXTMETSURL" select="concat('cocoon://metadata/',$HANDLE,'/mets.xml?rightsMDTypes=METSRIGHTS')"/>
<!-- Retrieve the rights information (as a cocoon request) -->
<xsl:variable name="EXTMETS" select="document($EXTMETSURL)"/>
<!-- Point this variable at a specific bitstream of interest (such as the primary bitstream or the first original bitstream)-->
<xsl:variable name="bit" select="..."/>
<!-- Retrieve the rights information for a specific bitstream -->
<xsl:variable name="bitmets" select="$EXTMETS//mets:fileSec/mets:fileGrp[@USE='ORIGINAL']/mets:file[@GROUPID=$bit/@GROUPID]"/>
<!-- Get the authorization id for the bitstream -->
<xsl:variable name="authid" select="$bitmets/@ADMID"/>
<!-- Get the authorization record based on that id -->
<xsl:variable name="authrec" select="$EXTMETS//mets:rightsMD[@ID=$authid]"/>
<!-- Check that General Public (aka Anonymous) can access that record -->
<xsl:variable name="pubrec" select="$authrec//metsrights:Context[@in-effect='true'][@CONTEXTCLASS='GENERAL PUBLIC']"/>