function can_publish(req, project_id, cb) {
    //TODO - why does this exist?
    if(typeof project_id === 'string') project_id = mongoose.Types.ObjectId(project_id);
    
    //check user has access to the project
    common.getprojects(req.user, function(err, canread_project_ids, canwrite_project_ids) {
        if(err) return cb(err);
        let found = canwrite_project_ids.find(id=>id.equals(project_id));
        cb(null, found);
    });
}
//check if user can publish this project
check if user can publish this project
check if user can publish this project
function can_publish(req, project_id, cb) {
    if(typeof project_id === 'string') project_id = mongoose.Types.ObjectId(project_id);
    common.getprojects(req.user, function(err, canread_project_ids, canwrite_project_ids) {
        if(err) return cb(err);
        let found = canwrite_project_ids.find(id=>id.equals(project_id));
        cb(null, found);
    });
}
function can_publish ( req , project_id , cb ) { if ( typeof project_id === 'string' ) project_id = mongoose . Types . ObjectId ( project_id ) ; common . getprojects ( req . user , function ( err , canread_project_ids , canwrite_project_ids ) { if ( err ) return cb ( err ) ; let found = canwrite_project_ids . find ( id => id . equals ( project_id ) ) ; cb ( null , found ) ; } ) ; }
check if user can publish this project
check if user can publish this project
//TODO - why does this exist? //check user has access to the project