Ignore:
Timestamp:
2023-10-16T16:23:07+13:00 (8 months ago)
Author:
anupama
Message:

Incremental change to allow user editing for any accounts who have collection editing powers (not just admin). Future changse would be a full overhaul as they'll happen in the document editor and are unlikely to use the new remove-metadata-array methods.

Location:
main/trunk/greenstone3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java

    r38219 r38316  
    339339        String lang = request.getAttribute(GSXML.LANG_ATT);
    340340       
    341         boolean isAdminRemovingUserComments = false;
    342        
    343         // Have to be admin to do remove-metadata-array for user comments meta fields
    344         if (metaserver_command.equals("remove-metadata-array")) {
    345         // check if only removing user comments metadata fields
    346         docids = getDocIdsWithOptFilter(json_str, allowedMetaFieldsPattern);
    347         if(docids != null) {
    348             isAdminRemovingUserComments = true;
    349         }
    350 
    351         if(!userIsAdministrator(request, params)) {
    352             isAdminRemovingUserComments = false;
    353             return errorResponse("processModifyMetadata", NO_PERMISSIONS_ERROR, lang);
    354         }       
    355         }
    356 
    357         if(isAdminRemovingUserComments) {
    358         // everything is set up already now for admin to remove user comments
    359         }       
    360         else if (userHasCollectionEditPermissions(request, params)) { // means user can modify ANY metadata
    361 
     341        if (userHasCollectionEditPermissions(request, params)) { // means user can modify ANY metadata
     342        if (metaserver_command.equals("remove-metadata-array")) {
     343            // check if only removing user comments metadata fields
     344            docids = getDocIdsWithOptFilter(json_str, allowedMetaFieldsPattern);
     345            if(docids == null) {
     346            // removing multiple metadata that are Not user comments
     347            // can be done by any user with collection edit permissions
     348            docids = getDocIdsWithOptFilter(json_str, null);
     349            }
     350        }
    362351        // if dealing with an array of meta, then parse out the docids from the json
    363         if(supportsSettingMultipleMeta) {
    364             docids = getDocIdsWithOptFilter(json_str, null);
    365         } else if (metaserver_command.equals("remove-metadata-array")) {
    366             // removing multiple metadata that are Not user comments
    367             // can be done by any user with collection edit permissions
     352        else if(supportsSettingMultipleMeta) {
    368353            docids = getDocIdsWithOptFilter(json_str, null);
    369354        } // else set-meta operation on single metadata field of single doc,
  • main/trunk/greenstone3/web/interfaces/default/transform/layouts/usercomments.xsl

    r38188 r38316  
    4545  <gsf:variable name="userCanDeleteComments">
    4646    <xsl:choose>
    47       <xsl:when test="/page/pageRequest/userInformation and (util:csvContains(/page/pageRequest/userInformation/@groups, 'administrator'))">1</xsl:when><xsl:otherwise>0</xsl:otherwise>
     47      <!--<xsl:when test="/page/pageRequest/userInformation and (util:csvContains(/page/pageRequest/userInformation/@groups, 'administrator'))">1</xsl:when><xsl:otherwise>0</xsl:otherwise>-->
     48      <xsl:when test="$canDoEditing = 'true'">1</xsl:when><xsl:otherwise>0</xsl:otherwise>
    4849    </xsl:choose>
    4950  </gsf:variable>
Note: See TracChangeset for help on using the changeset viewer.