[pLog-svn] r4111 - plog/trunk/class/action/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Mon Oct 9 11:51:33 GMT 2006


Author: oscar
Date: 2006-10-09 11:51:33 +0000 (Mon, 09 Oct 2006)
New Revision: 4111

Modified:
   plog/trunk/class/action/admin/adminaction.class.php
   plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php
   plog/trunk/class/action/admin/adminaddlinkaction.class.php
   plog/trunk/class/action/admin/adminaddlinkcategoryaction.class.php
   plog/trunk/class/action/admin/admindeletecustomfieldsaction.class.php
   plog/trunk/class/action/admin/admindeletelinkaction.class.php
   plog/trunk/class/action/admin/admindeletelinkcategoryaction.class.php
   plog/trunk/class/action/admin/admineditcustomfieldaction.class.php
   plog/trunk/class/action/admin/admineditlinkaction.class.php
   plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php
   plog/trunk/class/action/admin/adminnewcustomfieldaction.class.php
   plog/trunk/class/action/admin/adminnewlinkaction.class.php
   plog/trunk/class/action/admin/adminnewlinkcategoryaction.class.php
   plog/trunk/class/action/admin/adminupdatecustomfieldaction.class.php
   plog/trunk/class/action/admin/adminupdatelinkaction.class.php
   plog/trunk/class/action/admin/adminupdatelinkcategoryaction.class.php
Log:
just testing, putting some permission checks in place to see how it all works


Modified: plog/trunk/class/action/admin/adminaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -96,7 +96,7 @@
 			    if( !$find ) {
 			        $this->_userBlogs[] = $this->_blogInfo;
 			    }
-            }
+            }            
         }
 
         /**
@@ -119,7 +119,7 @@
         {
             $session = HttpVars::getSession();
             $sessionInfo = $session["SessionInfo"];
-            $this->_userInfo = $sessionInfo->getValue("userInfo");
+            $this->_userInfo = $sessionInfo->getValue("userInfo");           
         }
 
         /**
@@ -223,5 +223,13 @@
 			
 			return $this->_pm->notifyEvent( $eventType, $params );
 		}
+		
+		/**
+		 * tbd
+		 */
+		function userHasPermission( $permName )
+		{
+	    	return( $this->_userInfo->hasPermissionByName( $permName, $this->_blogInfo->getId()));    
+		}
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -37,6 +37,14 @@
 			$this->_form->registerField( "fieldValues" );
 			$this->setValidationErrorView( new AdminTemplatedView( $this->_blogInfo, "newcustomfield" ));
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "add_custom_field" ));
+        }         
 		
         /**
          * Carries out the specified action

Modified: plog/trunk/class/action/admin/adminaddlinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddlinkaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminaddlinkaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -44,6 +44,14 @@
 			$view->setErrorMessage( $this->_locale->tr("error_adding_link" ));
 			$this->setValidationErrorView( $view );
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "add_link" ));
+        }        
 
         /**
          * Carries out the specified action

Modified: plog/trunk/class/action/admin/adminaddlinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddlinkcategoryaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminaddlinkcategoryaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -30,8 +30,15 @@
 			$this->registerFieldValidator( "linkCategoryName", new StringValidator());
 			$this->setValidationErrorView( new AdminTemplatedView( $this->_blogInfo, "newlinkcategory" ));
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "add_link_category" ));
+        }
 
-
         /**
          * Carries out the specified action
          */

Modified: plog/trunk/class/action/admin/admindeletecustomfieldsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletecustomfieldsaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/admindeletecustomfieldsaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -31,9 +31,16 @@
 				$this->registerFieldValidator( "fieldIds", new ArrayValidator());
 			$view = new AdminCustomFieldsListView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_incorrect_field_id"));
-			$this->setValidationErrorView( $view );
-			
+			$this->setValidationErrorView( $view );			
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "update_custom_field" ));
+        }        
 		
 		/**
 		 * prepares the data for AdminDeleteCustomFieldsAction::_deleteFields

Modified: plog/trunk/class/action/admin/admindeletelinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletelinkaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/admindeletelinkaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -40,6 +40,14 @@
 			$this->setValidationErrorView( $view );
 			
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "update_link" ));
+        }        
 		
 		function perform()
 		{

Modified: plog/trunk/class/action/admin/admindeletelinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletelinkcategoryaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/admindeletelinkcategoryaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -36,6 +36,14 @@
 			$view->setErrorMessage( $this->_locale->tr("error_invalid_link_category_id"));			
 			$this->setValidationErrorView( $view );
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "update_link_category" ));
+        }        
 		
 		function perform()
 		{

Modified: plog/trunk/class/action/admin/admineditcustomfieldaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditcustomfieldaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/admineditcustomfieldaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -34,8 +34,15 @@
 			$this->_form->registerField( "fieldHidden" );
 			$this->_form->registerField( "fieldValues" );
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "update_custom_field" ));
+        }
 
-
         /**
          * Carries out the specified action
          */

Modified: plog/trunk/class/action/admin/admineditlinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinkaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/admineditlinkaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -36,6 +36,14 @@
 			$view->setErrorMessage( $this->_locale->tr("error_fetching_link" ));
 			$this->setValidationErrorView( $view );
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	 return( $this->userHasPermission( "update_link" ));
+        }        
 
         /**
          * Carries out the specified action

Modified: plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -32,6 +32,14 @@
 			$view->setErrorMessage( $this->_locale->tr("error_incorrect_link_category_id"));
 			$this->setValidationErrorView( $view );
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "update_link_category" ));
+        }        
 
         /**
          * Carries out the specified action

Modified: plog/trunk/class/action/admin/adminnewcustomfieldaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewcustomfieldaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminnewcustomfieldaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -16,6 +16,14 @@
         {
         	$this->BlogOwnerAdminAction( $actionInfo, $request );
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "add_custom_field" ));
+        }        
 
         /**
          * Carries out the specified action

Modified: plog/trunk/class/action/admin/adminnewlinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewlinkaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminnewlinkaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -23,6 +23,14 @@
         {
             $this->AdminAction( $actionInfo, $request );
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "add_link" ));
+        }
 
         /**
          * Carries out the specified action

Modified: plog/trunk/class/action/admin/adminnewlinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewlinkcategoryaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminnewlinkcategoryaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -20,6 +20,14 @@
         {
         	$this->AdminAction( $actionInfo, $request );
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission(  "add_link_category" ));    
+        }        
 
         /**
          * Carries out the specified action

Modified: plog/trunk/class/action/admin/adminupdatecustomfieldaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatecustomfieldaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminupdatecustomfieldaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -37,6 +37,14 @@
 			$this->_form->registerField( "fieldValues" );
 			$this->setValidationErrorView( new AdminTemplatedView( $this->_blogInfo, "editcustomfield" ));			
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "update_custom_field" ));
+        }        
 
         /**
          * Carries out the specified action

Modified: plog/trunk/class/action/admin/adminupdatelinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatelinkaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminupdatelinkaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -45,6 +45,14 @@
 			$this->setValidationErrorView( $view );
 			
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "update_link" ));
+        }        
 
         /**
          * Carries out the specified action

Modified: plog/trunk/class/action/admin/adminupdatelinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatelinkcategoryaction.class.php	2006-10-09 10:44:51 UTC (rev 4110)
+++ plog/trunk/class/action/admin/adminupdatelinkcategoryaction.class.php	2006-10-09 11:51:33 UTC (rev 4111)
@@ -34,6 +34,14 @@
 			$errorView->setErrorMessage( $this->_locale->tr("error_updating_link_category"));
 			$this->setValidationErrorView( $errorView );
         }
+        
+        /** 
+         * check user permissions and reject if needed
+         */
+        function canPerform()
+        {
+	    	return( $this->userHasPermission( "update_link_category" ));
+        }        
 
         /**
          * Carries out the specified action



More information about the pLog-svn mailing list