r4901 - trunk/src/perl

walbridge at ecoinformatics.org walbridge at ecoinformatics.org
Fri Apr 3 14:47:41 PDT 2009


Author: walbridge
Date: 2009-04-03 14:47:41 -0700 (Fri, 03 Apr 2009)
New Revision: 4901

Modified:
   trunk/src/perl/register-dataset.cgi
Log:
Three small fixes: 
 - 'salutation' was misspelled and wasn't picked up correctly in document modificiation
 - keyword handling wasn't setting the thesaurus correctly
 - check against the full list of moderators for the ACL validation


Modified: trunk/src/perl/register-dataset.cgi
===================================================================
--- trunk/src/perl/register-dataset.cgi	2009-04-03 20:34:14 UTC (rev 4900)
+++ trunk/src/perl/register-dataset.cgi	2009-04-03 21:47:41 UTC (rev 4901)
@@ -2035,7 +2035,7 @@
             dontOccur($node, "../positionName|../onlineURL|../userId", 
               "positionName, onlineURL, userId");
         
-            dontOccur($node, "./saluation", "saluation");                
+            dontOccur($node, "./salutation", "salutation");                
         
             debug("Checking a creator in loop 1...");
             $tempResult = $node->findnodes('../address|../phone|../electronicmailAddress|../organizationName');
@@ -2217,18 +2217,20 @@
 
     my $count = 1;
     foreach $node ($results->get_nodelist) {
+        my $thesaurus = findValue($node, "keywordThesaurus");
         $tempResult = $node->findnodes('./keyword');
         foreach $tempNode ($tempResult->get_nodelist) {
             $$templateVars{"keyword$count"} = $tempNode->textContent();
             if ($tempNode->hasAttributes()) {
                 my @attlist = $tempNode->attributes();
-                my $tmp = $attlist[0]->value;  #convert the first letter to upper case
-                $tmp =~ s/\b(\w)/\U$1/g;
+                my $tmp = $attlist[0]->value;
+                $tmp =~ s/\b(\w)/\U$1/g; # convert the first letter to upper case
                 $$templateVars{"kwType$count"} = $tmp;
             }
+            $$templateVars{"kwTh$count"} = $thesaurus;
+            #debug("Keyword Found: $count `" . $tempNode->textContent() . "`, $thesaurus");
+            $count++;
         }
-        $$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus");
-        $count++;
     }
 
     $$templateVars{'keyCount'} = $count;
@@ -2579,10 +2581,13 @@
                 $permission = $child->textContent();
             }
         }
+        # if the principal is any one of the moderators, the script will handle it
+        my @admins = $moderators;
+        push(@admins, $adminUsername);
 
         if ($principal eq 'public' && $permission ne 'read') { $accessError = 1; }
         if ($principal eq $adminUsername && $permission ne 'all') { $accessError = 2; }
-        if ($principal ne 'public' && $principal ne $adminUsername && $permission ne 'all') { $accessError = 3; }
+        if ($principal ne 'public' && !grep {$_ eq $principal} @admins && $permission ne 'all') { $accessError = 3; }
         # TODO: FIXME for 1.9.1
         # The ESA skin has a separate concept of 'moderator', which is defined by a property
         # within the configuration. This should be updated to check the user against the groups.



More information about the Metacat-cvs mailing list