agave-metadata/metadata-core/src/main/java/org/iplantc/service/metadata/dao/MetadataDao.java
/**
     * Update the permission for the specified user to the specified permission
     *
     * @param metadataItem to be updated
     * @return all the permissions for the metadata item including the updated one.
     */
Update the permission for the specified user to the specified permission
@param metadataItem to be updated
@return all the permissions for the metadata item including the updated one.
Update the permission for the specified user to the specified permission @param metadataItem to be updated @return all the permissions for the metadata item including the updated one .
public List<MetadataPermission> updatePermission(MetadataItem metadataItem) throws MetadataStoreException {
        MongoCollection<MetadataItem> metadataItemMongoCollection;
        UpdateResult update;
        try {
            metadataItemMongoCollection = getDefaultMetadataItemCollection();
            Bson uuidAndTenantQuery = getUuidAndTenantIdQuery(metadataItem.getUuid(), metadataItem.getTenantId());
            update = metadataItemMongoCollection.updateOne(uuidAndTenantQuery, set("permissions", metadataItem.getPermissions()));
            if (update.getMatchedCount() == 1) {
                MetadataItem updatedItem = findSingleMetadataItem(uuidAndTenantQuery);
                if (updatedItem != null) {
                    return updatedItem.getPermissions();
                } else {
                    throw new MetadataStoreException("Metadata item " + metadataItem.getUuid() + " is no longer present.");
                }
            } else {
                throw new MetadataStoreException("Failed to update permissions of metadata item " + metadataItem.getUuid());
            }
        } catch (MetadataStoreException e) {
            throw e;
        } catch (Exception e) {
            throw new MetadataStoreException("Failed to update permission", e);
        }
    }
public List < MetadataPermission > updatePermission ( MetadataItem metadataItem ) throws MetadataStoreException { MongoCollection < MetadataItem > metadataItemMongoCollection ; UpdateResult update ; try { metadataItemMongoCollection = getDefaultMetadataItemCollection ( ) ; Bson uuidAndTenantQuery = getUuidAndTenantIdQuery ( metadataItem . getUuid ( ) , metadataItem . getTenantId ( ) ) ; update = metadataItemMongoCollection . updateOne ( uuidAndTenantQuery , set ( "permissions" , metadataItem . getPermissions ( ) ) ) ; if ( update . getMatchedCount ( ) == 1 ) { MetadataItem updatedItem = findSingleMetadataItem ( uuidAndTenantQuery ) ; if ( updatedItem != null ) { return updatedItem . getPermissions ( ) ; } else { throw new MetadataStoreException ( "Metadata item " + metadataItem . getUuid ( ) + " is no longer present." ) ; } } else { throw new MetadataStoreException ( "Failed to update permissions of metadata item " + metadataItem . getUuid ( ) ) ; } } catch ( MetadataStoreException e ) { throw e ; } catch ( Exception e ) { throw new MetadataStoreException ( "Failed to update permission" , e ) ; } }
Update the permission for the specified user to the specified permission
 @param metadataItem to be updated
 @return all the permissions for the metadata item including the updated one.
Update the permission for the specified user to the specified permission @param metadataItem to be updated @return all the permissions for the metadata item including the updated one .
//get collection //update success. fetch the doc