IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 27, 2015, 1:52:41 PM (11 years ago)
Author:
bills
Message:

minor changes to the parser implmented in pre-deployment testing in the ipp-20141024 tag

File:
1 edited

Legend:

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

    r38160 r38195  
    200200
    201201
     202
     203my $label_changed = 0;
     204if (0) {
    202205# Adjust the label for requests coming in over the web upload interface
    203206# XXX: do this later based on the user information
    204 
    205 my $label_changed = 0;
    206207# We now use the access tabels to set the label.
    207 if (0) {
    208208if ($label and $label eq "WEB.UP") {
    209209    my $lcname = lc($req_name);
     
    234234}
    235235
    236 # XXX: update these comments
    237 # product passed in is either one specific to the submitting pstampDataStore or the default
    238 # "pstampresults"
    239 # Here, we need to decide whether to change that based on email
    240 # WE can't use label (yet) because the PSI cgi script sets it to PSI
    241 # Do we ever need to use label? Is it obsolete? Check test procedures.
    242 
     236# based on the user's email address get the accessLevel, default label and data store product
    243237my $productForUser;
    244 my $labelForUser = $label;  # for now I pass the current label for use in hacking permissions for V1 requests
     238my $labelForUser = $label;  # XXX: for now I pass the current label for use in hacking permissions for V1 requests.
    245239
    246240my $accessLevel = getUsersAccessLevel($email, \$labelForUser, \$productForUser);
    247241if ($accessLevel < 0) {
    248     print STDERR "Data access is forbidden.\n";
     242    print STDERR "Data access is forbidden for $email.\n";
    249243    insertFakeJobForRow(undef, 0, $PSTAMP_NOT_AUTHORIZED);
    250244}
    251245
    252 # if the request came through the upload channel, change it to the user's specific label
     246# if the request came through the request table upload channel, change it to the user's specific label
    253247# if any is known. Do we want to do this for any other channels?
     248# requests from data store will have those values.
    254249if ($label and $label eq 'WEB.UP') {
    255250    if ($labelForUser) {
     
    259254}
    260255
    261 # XXX: Think through when and if we change the product.
    262256# If the product is the system default, set it to the product for the user@domain. That way
    263257# if the request came through a data store that target will be used.
    264 # We really only need to redirect the results with greater access level than the default
     258# We really only need to redirect the results with greater access level than the default.
     259# note that for most users productForUser will be undef so the default will be used.
    265260if ($productIsDefault or $product eq 'NULL') {
    266261    if ($productForUser) {
     
    297292}
    298293
     294# in these two error conditions we are done. The invoking script will finish up.
    299295if ($duplicate_req_name) {
    300296    exit 0;
     
    378374
    379375if (($action eq 'LIST' or $mode eq "queue_job") and ($num_jobs eq 0)) {
    380     # this should not happen. The function above is required to insert a fake job for any
     376    # this should not happen. The processRow is required to insert a fake job for any
    381377    # rows that did not yield any jobs.
    382378    print STDERR "ERROR: zero jobs created for $req_name\n";
     
    594590    my $rownum      = $row->{ROWNUM};
    595591
     592    my $mjd_max;
     593    my $adjustedDateCuts = adjustDateCuts($row, \$mjd_max);
     594    if ($adjustedDateCuts and $mjd_max < 0) {
     595        print STDERR "User is not authorized for data from this project.\n";
     596        insertFakeJobForRow($row, 1, $PSTAMP_NOT_AUTHORIZED);
     597        $num_jobs++;
     598        return $num_jobs;
     599    }
     600
    596601    # Since user can get unmagicked data "by coordinate" requests can go back in time
    597602    # to dredge unusable data from the "dark days"...
     
    608613        # if this user does not have unlimited access rights adjust the date cut
    609614        # to avoid more recent data
    610         my $mjd_max;
    611615        # We do not adjust dates for stacks since they are not well defined enough.
    612616        # We'll need to filter them by accessLevel during the lookup
    613617        my $stage = $row->{IMG_TYPE};
    614         if ($stage ne 'stack' and adjustDateCuts($row, \$mjd_max)) {
     618        if ($stage ne 'stack' and $adjustedDateCuts) {
    615619            # if lower limit was supplied by user we can leave the value alone
    616620            if ($row->{MJD_MAX}) {
Note: See TracChangeset for help on using the changeset viewer.