IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38133 for trunk


Ignore:
Timestamp:
Apr 16, 2015, 1:56:14 PM (11 years ago)
Author:
bills
Message:

remove prototype code. Change some column names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstampparse.pl

    r38132 r38133  
    177177    my $exitStatus = $error_code >> 8;
    178178    if ($success) {
    179         # -listreq succeeded duplicate request name
     179        # -listreq succeeded there is already a request in the database with this name
    180180        print STDERR "REQ_NAME $req_name has already been used\n";
    181181        insertFakeJobForRow(undef, 0, $PSTAMP_DUP_REQUEST);
     
    192192
    193193my $label_changed = 0;
    194 # see below
     194# We now use the access tabels to set the label.
    195195if (0) {
    196196if ($label and $label eq "WEB.UP") {
     
    222222}
    223223
     224# XXX: update these comments
    224225# product passed in is either one specific to the submitting pstampDataStore or the default
    225226# "pstampresults"
     
    228229# Do we ever need to use label? Is it obsolete? Check test procedures.
    229230
    230 # XXX perhaps do this prior to label setting above after domain/user table is implemented
    231231my $productForUser;
    232 my $labelForUser = $label;
     232my $labelForUser = $label;  # for now I pass the current label for use in hacking permissions for V1 requests
     233
    233234my $accessLevel = getUsersAccessLevel($email, \$labelForUser, \$productForUser);
    234235if ($accessLevel < 0) {
     
    237238}
    238239
     240# if the request came through the upload channel, change it to the user's specific label
     241# if any is known.
    239242if ($label and $label eq 'WEB.UP') {
    240243    if ($labelForUser) {
     
    245248
    246249# XXX: Think through when and if we change the product.
    247 # if the product is the system default, set it to the product for the user@domain
     250# If the product is the system default, set it to the product for the user@domain. That way
     251# if the request came through a data store that target will be used.
     252# We really only need to redirect the results with greater access level than the default
    248253if ($productIsDefault or $product eq 'NULL') {
    249254    if ($productForUser) {
     
    251256    }
    252257} else {
     258    # if we don't have a product use default
    253259    if ($product eq 'NULL') {
    254260        $product = $defaultDSProduct;
    255261    }
    256262}
     263
    257264if (!$product or $product eq 'NULL') {
     265    # this will only happen if the site.config variable is missing.
    258266    my_die("No product found.\n", $PS_EXIT_CONFIG_ERROR);
    259267}
    260268
    261269{
    262     # update the database with the request name. This will be used as the
    263     # the fileset name in the output data store
     270    # update the request's row with the new parameters.
     271    # The requset name will be used to set the output fileset name in the output data store.
    264272    my $command = "$pstamptool -updatereq -req_id $req_id  -set_name $req_name";
    265273    $command .= " -set_username $email" if $email ne 'null';
     
    277285}
    278286
     287if ($duplicate_req_name) {
     288    exit 0;
     289}
     290
    279291if ($accessLevel < 0) {
    280292    exit 0;
    281293}
    282294
    283 if ($duplicate_req_name) {
    284     exit 0;
    285 }
    286295
    287296#
     
    12881297    }
    12891298
    1290 my $have_access_tables = 1;
    1291 if ($have_access_tables) {
    1292 
    12931299    my $cmd = "$pstamptool -listuser -user $user -domain $domain";
    12941300    my $results = runToolAndParse($cmd, $verbose);
    12951301    my $userinfo = $results->[0];
    12961302    if ($userinfo) {
    1297         $level = $userinfo->{accessLevelMax};
     1303        $level = $userinfo->{accessLevel};
    12981304        if ($userinfo->{userProduct}) {
    12991305            $$r_product = $userinfo->{userProduct};
     
    13111317        my $domaininfo = $results->[0];
    13121318        if ($domaininfo) {
    1313             $level = $domaininfo->{accessLevelMax};
     1319            $level = $domaininfo->{accessLevel};
    13141320            if ($domaininfo->{defaultProduct}) {
    13151321                $$r_product = $domaininfo->{defaultProduct};
     
    13251331        }
    13261332    }
    1327 } else {    # XXX: delete this prototype before committing this file starting here
    1328     # !$have_access_tables
    1329     $domain = lc($domain);
    1330     if ($domain eq 'ifa.hawaii.edu' or $domain eq 'qub.ac.uk') {
    1331         $level = 2;
    1332     } else {
    1333         # access rights PS1 data only
    1334         $level = $defaultAccessLevel;
    1335     }
    1336 
    1337     if ($user eq 'bills' and $domain eq 'ifa.hawaii.edu') {
    1338         $$r_product = 'bills-results';
    1339     }
    1340     # XXX end of code to delete
    1341 
    1342 }
    13431333
    13441334    return $level;
Note: See TracChangeset for help on using the changeset viewer.