Index: trunk/pstamp/scripts/pstampparse.pl
===================================================================
--- trunk/pstamp/scripts/pstampparse.pl	(revision 38132)
+++ trunk/pstamp/scripts/pstampparse.pl	(revision 38133)
@@ -177,5 +177,5 @@
     my $exitStatus = $error_code >> 8;
     if ($success) {
-        # -listreq succeeded duplicate request name
+        # -listreq succeeded there is already a request in the database with this name
         print STDERR "REQ_NAME $req_name has already been used\n";
         insertFakeJobForRow(undef, 0, $PSTAMP_DUP_REQUEST);
@@ -192,5 +192,5 @@
 
 my $label_changed = 0;
-# see below
+# We now use the access tabels to set the label.
 if (0) {
 if ($label and $label eq "WEB.UP") {
@@ -222,4 +222,5 @@
 }
 
+# XXX: update these comments
 # product passed in is either one specific to the submitting pstampDataStore or the default
 # "pstampresults"
@@ -228,7 +229,7 @@
 # Do we ever need to use label? Is it obsolete? Check test procedures.
 
-# XXX perhaps do this prior to label setting above after domain/user table is implemented
 my $productForUser;
-my $labelForUser = $label;
+my $labelForUser = $label;  # for now I pass the current label for use in hacking permissions for V1 requests
+
 my $accessLevel = getUsersAccessLevel($email, \$labelForUser, \$productForUser);
 if ($accessLevel < 0) {
@@ -237,4 +238,6 @@
 }
 
+# if the request came through the upload channel, change it to the user's specific label
+# if any is known.
 if ($label and $label eq 'WEB.UP') {
     if ($labelForUser) {
@@ -245,5 +248,7 @@
 
 # XXX: Think through when and if we change the product.
-# if the product is the system default, set it to the product for the user@domain
+# If the product is the system default, set it to the product for the user@domain. That way 
+# if the request came through a data store that target will be used.
+# We really only need to redirect the results with greater access level than the default
 if ($productIsDefault or $product eq 'NULL') {
     if ($productForUser) {
@@ -251,15 +256,18 @@
     }
 } else {
+    # if we don't have a product use default
     if ($product eq 'NULL') {
         $product = $defaultDSProduct;
     }
 }
+
 if (!$product or $product eq 'NULL') {
+    # this will only happen if the site.config variable is missing.
     my_die("No product found.\n", $PS_EXIT_CONFIG_ERROR);
 }
 
 {
-    # update the database with the request name. This will be used as the
-    # the fileset name in the output data store
+    # update the request's row with the new parameters.
+    # The requset name will be used to set the output fileset name in the output data store.
     my $command = "$pstamptool -updatereq -req_id $req_id  -set_name $req_name";
     $command .= " -set_username $email" if $email ne 'null';
@@ -277,11 +285,12 @@
 }
 
+if ($duplicate_req_name) {
+    exit 0;
+}
+
 if ($accessLevel < 0) {
     exit 0;
 }
 
-if ($duplicate_req_name) {
-    exit 0;
-}
 
 #
@@ -1288,12 +1297,9 @@
     } 
 
-my $have_access_tables = 1;
-if ($have_access_tables) {
-
     my $cmd = "$pstamptool -listuser -user $user -domain $domain";
     my $results = runToolAndParse($cmd, $verbose);
     my $userinfo = $results->[0];
     if ($userinfo) {
-        $level = $userinfo->{accessLevelMax};
+        $level = $userinfo->{accessLevel};
         if ($userinfo->{userProduct}) {
             $$r_product = $userinfo->{userProduct};
@@ -1311,5 +1317,5 @@
         my $domaininfo = $results->[0];
         if ($domaininfo) {
-            $level = $domaininfo->{accessLevelMax};
+            $level = $domaininfo->{accessLevel};
             if ($domaininfo->{defaultProduct}) {
                 $$r_product = $domaininfo->{defaultProduct};
@@ -1325,20 +1331,4 @@
         }
     }
-} else {    # XXX: delete this prototype before committing this file starting here
-    # !$have_access_tables 
-    $domain = lc($domain);
-    if ($domain eq 'ifa.hawaii.edu' or $domain eq 'qub.ac.uk') {
-        $level = 2;
-    } else {
-        # access rights PS1 data only
-        $level = $defaultAccessLevel;
-    }
-
-    if ($user eq 'bills' and $domain eq 'ifa.hawaii.edu') {
-        $$r_product = 'bills-results';
-    }
-    # XXX end of code to delete
-
-}
 
     return $level;
