[pmwiki-devel] Localizing changes from IsAuthorized as well as HandleAttr

Danny Kimsey dekimsey at bellsouth.net
Thu Feb 1 14:00:04 CST 2007


I have made some rather minor changes to the pmwiki.php file to
utilize some functions that I have included from a custom php file.
Of course when it comes to upgrading or whatnot, this will break the
current wiki I have set up.  I'd like to move as many of the
modifications as possible out of pmwiki and into a local configuration
file if at all possible.
Essentially I've added an additonal check to IsAuthorized.
And redirected the PrintAttrForm to my own function.
As both of these are defined inline in the functions I'm not sure how
I can implement them in an external include file.  For reference I'm
including the diff of the my pmwiki file.
Any help in learning how to move these changes out would be greatly
appreciated.  Thanks!

-danny.
===================================================
--- pmwiki.php.orig     2007-01-22 13:35:26.000000000 -0500
+++ pmwiki.php  2007-02-01 14:37:43.000000000 -0500
@@ -1670,7 +1679,8 @@
 }

 function IsAuthorized($chal, $source, &$from) {
-  global $AuthList, $AuthPw, $AllowPassword;
+  #-- Access GL_PERMISSION and gl_name for happy transparent security
+  global $AuthList, $AuthPw, $AllowPassword, $GL_PERMISSION, $gl_name;
   if (!$chal) return $from;
   $auth = 0;
   $passwd = array();
@@ -1686,6 +1696,14 @@
       $passwd[] = $pw;
       if ($auth < 0) continue;
       if ($x || $pw{0} == '@') {
+       #-- This takes care of transparent security:
+        #-- If the group name in the attribute is the same
+        #-- as a permission from signin, e.g. "@Supervisor" (case-sensitive)
+        #-- logged in users with that permission are granted access.
+        if ($GL_PERMISSION[$gl_name][substr($pw,1)]) {
+               $auth = 1;
+               continue;
+       }
         if (@$AuthList[$pw]) $auth = $AuthList[$pw];
         continue;
       }
@@ -1772,7 +1790,8 @@
     <h2 class='wikiaction'>$[{\$FullName} Attributes]</h2>
     <p>$[EnterAttributes]</p></div>");
   SDV($HandleAttrFmt,array(&$PageStartFmt,&$PageAttrFmt,
-    'function:PrintAttrForm',&$PageEndFmt));
+#   'function:PrintAttrForm',&$PageEndFmt));
+    'function:PrintAttrCheckboxForm',&$PageEndFmt));
   PrintFmt($pagename,$HandleAttrFmt);
 }

===================================================



More information about the pmwiki-devel mailing list