agave-metadata/metadata-core/src/main/java/org/iplantc/service/metadata/dao/MetadataDao.java
/**
     * Check the mongodb if the {@code user} has the correct permissions
     * specified in {@code userFilter} for the metadata item for the
     * specified {@code uuid}
     *
     * @param uuid       the uuid of {@link MetadataItem}  to lookup
     * @param userFilter {@link Bson} query to check if user has the correct permissions
     * @return true if user has permissions specified by userFilter
     */
Check the mongodb if the  user has the correct permissions
specified in  userFilter for the metadata item for the
specified  uuid

@param uuid       the uuid of  MetadataItem  to lookup
@param userFilter  Bson query to check if user has the correct permissions
@return true if user has permissions specified by userFilter
Check the mongodb if the user has the correct permissions specified in userFilter for the metadata item for the specified uuid @param uuid the uuid of MetadataItem to lookup @param userFilter Bson query to check if user has the correct permissions @return true if user has permissions specified by userFilter
public boolean checkPermission(String uuid, Bson userFilter) {
        MongoCollection<MetadataItem> metadataItemMongoCollection;
        metadataItemMongoCollection = getDefaultMetadataItemCollection();
        MetadataItem result;
        try {
            result = metadataItemMongoCollection.find(and(eq("uuid", uuid),
                    userFilter)).first();
            if (result == null) {
                result = metadataItemMongoCollection.find(eq("uuid", uuid)).first();
                if (result == null) {
                    return true;
                }
            } else {
                return true;
            }
        } catch (NullPointerException npe) {
        }
        return false;
    }
public boolean checkPermission ( String uuid , Bson userFilter ) { MongoCollection < MetadataItem > metadataItemMongoCollection ; metadataItemMongoCollection = getDefaultMetadataItemCollection ( ) ; MetadataItem result ; try { result = metadataItemMongoCollection . find ( and ( eq ( "uuid" , uuid ) , userFilter ) ) . first ( ) ; if ( result == null ) { result = metadataItemMongoCollection . find ( eq ( "uuid" , uuid ) ) . first ( ) ; if ( result == null ) { return true ; } } else { return true ; } } catch ( NullPointerException npe ) { } return false ; }
Check the mongodb if the {@code user} has the correct permissions
 specified in {@code userFilter} for the metadata item for the
 specified {@code uuid}
Check the mongodb if the { @code user } has the correct permissions specified in { @code userFilter } for the metadata item for the specified { @code uuid }
//check if user has permission //check if uuid exists //metadata item doesn't exist, user can read or write