From: <rea...@us...> - 2009-12-23 01:28:42
|
Revision: 4806 http://sashimi.svn.sourceforge.net/sashimi/?rev=4806&view=rev Author: real_procopio Date: 2009-12-23 01:28:35 +0000 (Wed, 23 Dec 2009) Log Message: ----------- Optionally authenticate against an .htpasswd entry (from J.Slagel); Fix tabs (from 4.3 branch); Added a variable to hold location of tpp-bin; Refer to tpp_hostname by full path. Modified Paths: -------------- trunk/trans_proteomic_pipeline/CGI/tpp_gui/tpp_gui.pl Modified: trunk/trans_proteomic_pipeline/CGI/tpp_gui/tpp_gui.pl =================================================================== --- trunk/trans_proteomic_pipeline/CGI/tpp_gui/tpp_gui.pl 2009-12-23 01:18:19 UTC (rev 4805) +++ trunk/trans_proteomic_pipeline/CGI/tpp_gui/tpp_gui.pl 2009-12-23 01:28:35 UTC (rev 4806) @@ -42,6 +42,8 @@ my $debug = readconfig('debug',0); # set to 0 (zero) to suppress debug output to log file my $doMzXMLGzip = readconfig('doMzXMLGzip',0); # set to 1 to tell converters to gzip their mzxml output my $mascot_server = readconfig('mascot_server',"http://myserver/mascot/"); # Mascot server top-level url (if applicable) +my $htpasswd = readconfig('htpasswd',""); # Optionally authenticate using htpasswd file +my $tppbin = readconfig('tppbin',"/usr/bin"); # Location of TPP bin # # end config section ######################################################################## @@ -62,33 +64,34 @@ 'wget' => '/usr/bin/wget', # full path to wget 'cygpath' => '/usr/bin/cygpath', # full path to cygpath -- cygwin only # TPP executables - 'readw' => '/usr/bin/ReAdW', # some Windows installations only - 'mzwiff' => '/usr/bin/mzWiff', # some Windows installations only - 'masswolf' => '/usr/bin/massWolf', # some Windows installations only - 'trapper' => '/usr/bin/trapper', # some Windows installations only - 'decoyfasta' => '/usr/bin/decoyFASTA', - 'decoyvalpeps' => '/usr/bin/ProphetModels.pl', - 'decoyvalprots' => '/usr/bin/ProtProphModels.pl', - 'msconvert' => '/usr/bin/msconvert', - 'mzxml2search'=> '/usr/bin/MzXML2Search', - 'dta2mzxml' => '/usr/bin/dta2mzxml', - 'out2xml' => '/usr/bin/Out2XML', - 'mascot2xml' => '/usr/bin/Mascot2XML', - 'comet2xml' => '/usr/bin/Comet2XML', - 'tandem2xml' => '/usr/bin/Tandem2XML', - 'protxml2html'=> '/usr/bin/protxml2html.pl', - 'runsearch' => '/usr/bin/runsearch', # cygwin installations only - 'tandem' => '/usr/bin/tandem', - 'spectrast' => '/usr/bin/spectrast', - 'lib2html' => '/usr/bin/Lib2HTML', - 'downloader' => '/usr/bin/fileDownloader.pl', - 'qualscore' => 'java -jar ' . '/usr/bin/qualscore.jar', - 'xinteract' => '/usr/bin/xinteract', - 'interprophet'=> '/usr/bin/InterProphetParser', - 'runprophet' => '/usr/bin/ProteinProphet', - 'updateallpaths'=>'/usr/bin/updateAllPaths.pl', - 'chargefile' =>'/usr/bin/createChargeFile.pl', - 'mergecharges'=>'/usr/bin/mergeCharges.pl', + 'readw' => "$tppbin/ReAdW", # some Windows installations only + 'mzwiff' => "$tppbin/mzWiff", # some Windows installations only + 'masswolf' => "$tppbin/massWolf", # some Windows installations only + 'trapper' => "$tppbin/trapper", # some Windows installations only + 'decoyfasta' => "$tppbin/decoyFASTA", + 'decoyvalpeps' => "$tppbin/ProphetModels.pl", + 'decoyvalprots' => "$tppbin/ProtProphModels.pl", + 'msconvert' => "$tppbin/msconvert", + 'mzxml2search'=> "$tppbin/MzXML2Search", + 'dta2mzxml' => "$tppbin/dta2mzxml", + 'out2xml' => "$tppbin/Out2XML", + 'mascot2xml' => "$tppbin/Mascot2XML", + 'comet2xml' => "$tppbin/Comet2XML", + 'tandem2xml' => "$tppbin/Tandem2XML", + 'protxml2html'=> "$tppbin/protxml2html.pl", + 'runsearch' => "$tppbin/runsearch", # cygwin installations only + 'tandem' => "$tppbin/tandem", + 'spectrast' => "$tppbin/spectrast", + 'lib2html' => "$tppbin/Lib2HTML", + 'downloader' => "$tppbin/fileDownloader.pl", + 'qualscore' => 'java -jar ' . "$tppbin/qualscore.jar", + 'xinteract' => "$tppbin/xinteract", + 'interprophet'=> "$tppbin/InterProphetParser", + 'runprophet' => "$tppbin/ProteinProphet", + 'updateallpaths'=>"$tppbin/updateAllPaths.pl", + 'chargefile' => "$tppbin/createChargeFile.pl", + 'mergecharges'=> "$tppbin/mergeCharges.pl", + 'tpp_hostname'=> "$tppbin/tpp_hostname", ); my $in_windows = ( ($^O eq 'cygwin' )); # really this means in_cygwin, but that's a pervasive change to track @@ -956,20 +959,38 @@ # get parameters my $user = shift || ''; my $pswd = shift || ''; + my $upwd = ''; + my $ckey = ''; + + # get encrypted password + if ( $htpasswd ) { # use htpasswd to authenticate + &printToLog("looking in $htpasswd for password\n") if ($debug); + open(PWD, $htpasswd) || &fatalError('PWD_FILE',"Error verifying password!"); + while ( <PWD> ) { + chop(); + my ( $u, $p ) = split /:/; + $upwd = $p if ( $u eq $user ); + } + close(PWD); + $ckey = substr( $upwd, 0, 2 ); + } else { # use local password file in user dir + my $pfile = "${users_dir}$user/.password"; + &printToLog("looking in $pfile for password\n") if ($debug); + if ( -e $pfile ) { + open(PWD, $pfile) || &fatalError('PWD_FILE',"Error verifying password!"); + chomp($upwd = <PWD>); + close(PWD); + } + $ckey = $crypt_key; + } + &printToLog("stored password is: --$upwd--\n") if ($debug); - my $pfile = "${users_dir}$user/.password"; - if ( !($user && $pswd)) { push @messages, "Not enough information for login. Please fill out all fields."; - } elsif (!(-e $pfile)) { + } elsif (!$upwd) { push @messages, "User $user not found. Please check your user name, or log in as guest."; } else { - open(PWD, $pfile) || &fatalError('PWD_FILE',"Error verifying password!"); - chomp(my $upwd = <PWD>); - close(PWD); - &printToLog("stored password is: --$upwd--\n") if ($debug); - - if (crypt($pswd, $crypt_key) eq $upwd) { + if (crypt($pswd, $ckey) eq $upwd) { $retstr = 'OK'; } else { push @messages, "Incorrect password. Please re-enter."; @@ -1885,7 +1906,7 @@ push @messages, "Please 'Select' file(s) to process."; return 'topepxml'; } - my $pepxml_ext = `tpp_hostname GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext + my $pepxml_ext = `$command{tpp_hostname} GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext # Build commands # @@ -2515,7 +2536,7 @@ return 'runsearch'; } - my $pepxml_ext = `tpp_hostname GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext + my $pepxml_ext = `$command{tpp_hostname} GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext # Perform Basic Validation @@ -3296,7 +3317,7 @@ ######################################################################## sub isMassSpecFile { my $file_path = shift; - my $file_test = `tpp_hostname "$file_path"`; + my $file_test = `$command{tpp_hostname} "$file_path"`; return 1 if ($file_path eq $file_test); return 0; } @@ -3589,11 +3610,11 @@ { name => 'SpectraST Tools', pages=> 'spectrastlib,getspeclibs,lib2html'} ); if ($pipeline eq 'Mascot') { - $sections[2] = { name => 'Analysis Pipeline', pages=> 'mzxml,msconvert,runmascot,topepxml,xinteract,iprophet,runprophet'}; + $sections[3] = { name => 'Analysis Pipeline', pages=> 'mzxml,msconvert,runmascot,topepxml,xinteract,iprophet,runprophet'}; } elsif ($pipeline eq 'SpectraST') { - $sections[2] = { name => 'Analysis Pipeline', pages=> 'mzxml,msconvert,runspectrast,xinteract,iprophet,runprophet'}; + $sections[3] = { name => 'Analysis Pipeline', pages=> 'mzxml,msconvert,runspectrast,xinteract,iprophet,runprophet'}; } elsif ($pipeline eq 'Tandem') { - $sections[2] = { name => 'Analysis Pipeline', pages=> 'mzxml,msconvert,runtandem,topepxml,xinteract,iprophet,runprophet'}; + $sections[3] = { name => 'Analysis Pipeline', pages=> 'mzxml,msconvert,runtandem,topepxml,xinteract,iprophet,runprophet'}; } my %tabs = ( @@ -6582,7 +6603,7 @@ sub pageXInteract { # files to process (from session) - my $pepxml_ext = `tpp_hostname GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext + my $pepxml_ext = `$command{tpp_hostname} GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext my $any_files_there = &showFiles('xinteract','xinteract','xml','Select File(s) to Analyze'); @@ -7050,7 +7071,7 @@ ######################################################################## sub pageInterProphet { # files to process (from session) - my $pepxml_ext = `tpp_hostname GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext + my $pepxml_ext = `$command{tpp_hostname} GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext my $any_files_there = &showFiles('runprophet','iprophet','xml','Select File(s) to Analyze'); @@ -7157,7 +7178,7 @@ sub pageRunProphet { # files to process (from session) - my $protxml_ext = `tpp_hostname GET_PROTXML_EXT!`; # get TPP's idea of canonical protxml file ext + my $protxml_ext = `$command{tpp_hostname} GET_PROTXML_EXT!`; # get TPP's idea of canonical protxml file ext my $any_files_there = &showFiles('runprophet','runprophet','xml','Select File(s) to Analyze'); @@ -7373,8 +7394,8 @@ push @outfiles, $outf; # like foo.xml, or foo.pep.xml or foo.pep.xml.gz or foo.shtml - my $pepml_ext = `tpp_hostname GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext - my $prot_shtml_ext = `tpp_hostname GET_PROTXML_EXT!`; # get TPP's idea of canonical protxml file ext + my $pepml_ext = `$command{tpp_hostname} GET_PEPXML_EXT!`; # get TPP's idea of canonical pepxml file ext + my $prot_shtml_ext = `$command{tpp_hostname} GET_PROTXML_EXT!`; # get TPP's idea of canonical protxml file ext $pepml_ext =~ s/\.xml(\.gz)?$/\.shtml/; # like .pep.shtml $prot_shtml_ext =~ s/\.xml(\.gz)?$/\.shtml/; # like -prot.shtml, or .prot.shtml This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |