[pLog-svn] r4279 - in plog/trunk: class/action/admin templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sat Nov 11 14:29:33 GMT 2006


Author: oscar
Date: 2006-11-11 14:29:33 +0000 (Sat, 11 Nov 2006)
New Revision: 4279

Modified:
   plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php
   plog/trunk/class/action/admin/adminblogcategoriesaction.class.php
   plog/trunk/class/action/admin/admindeleteblogcategoryaction.class.php
   plog/trunk/class/action/admin/admineditblogcategoryaction.class.php
   plog/trunk/class/action/admin/adminnewblogcategoryaction.class.php
   plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php
   plog/trunk/templates/admin/blogcategories.template
Log:
added support for permission checking in the area of blog categories


Modified: plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php	2006-11-11 14:28:07 UTC (rev 4278)
+++ plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php	2006-11-11 14:29:33 UTC (rev 4279)
@@ -32,6 +32,8 @@
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "newblogcategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_adding_blog_category" ));			
 			$this->setValidationErrorView( $errorView );
+
+			$this->requireAdminPermission( "add_blog_category" );			
         }
 
         /**
@@ -52,7 +54,11 @@
 
             // once we have built the object, we can add it to the database!
             if( $categories->addBlogCategory( $category )) {
-				$this->_view = new AdminBlogCategoriesListView( $this->_blogInfo );
+				if( $this->userHasPermission( "view_blog_categories", ADMIN_PERMISSION )) 
+					$this->_view = new AdminBlogCategoriesListView( $this->_blogInfo );
+				else
+					$this->_view = new AdminTemplatedView( $this->_blogInfo, "newblogcategory" );
+				
 				$this->_view->setSuccess( true );
 				$this->_view->setSuccessMessage( $this->_locale->pr("blog_category_added_ok", $category->getName()));
 				

Modified: plog/trunk/class/action/admin/adminblogcategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminblogcategoriesaction.class.php	2006-11-11 14:28:07 UTC (rev 4278)
+++ plog/trunk/class/action/admin/adminblogcategoriesaction.class.php	2006-11-11 14:29:33 UTC (rev 4279)
@@ -9,6 +9,8 @@
 		function AdminBlogCategoriesAction( $actionInfo, $request )
 		{
 			$this->AdminAction( $actionInfo, $request );
+			
+			$this->requireAdminPermission( "view_blog_categories" );
 		}
 		
 		function perform()

Modified: plog/trunk/class/action/admin/admindeleteblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeleteblogcategoryaction.class.php	2006-11-11 14:28:07 UTC (rev 4278)
+++ plog/trunk/class/action/admin/admindeleteblogcategoryaction.class.php	2006-11-11 14:29:33 UTC (rev 4279)
@@ -36,7 +36,9 @@
 				
 			$view = new AdminBlogCategoriesListView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_incorrect_blog_category"));
-			$this->setValidationErrorView( $view );		
+			$this->setValidationErrorView( $view );	
+			
+			$this->requireAdminPermission( "update_blog_category" );	
         }
 
 		/**

Modified: plog/trunk/class/action/admin/admineditblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditblogcategoryaction.class.php	2006-11-11 14:28:07 UTC (rev 4278)
+++ plog/trunk/class/action/admin/admineditblogcategoryaction.class.php	2006-11-11 14:29:33 UTC (rev 4279)
@@ -23,7 +23,7 @@
          * Constructor. If nothing else, it also has to call the constructor of the parent
          * class, BlogAction with the same parameters
          */
-        function AdminEditGlobalArticleCategoryAction( $actionInfo, $request )
+        function AdminEditBlogCategoryAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
 			
@@ -32,6 +32,8 @@
 			$errorView = new AdminBlogCategoriesListView( $this->_blogInfo );
 			$errorView->setErrorMessage( $this->_locale->tr("error_incorrect_category_id"));
 			$this->setValidationErrorView( $errorView );
+		
+			$this->requireAdminPermission( "update_blog_category" );
         }
 
         /**

Modified: plog/trunk/class/action/admin/adminnewblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewblogcategoryaction.class.php	2006-11-11 14:28:07 UTC (rev 4278)
+++ plog/trunk/class/action/admin/adminnewblogcategoryaction.class.php	2006-11-11 14:29:33 UTC (rev 4279)
@@ -19,6 +19,8 @@
         function AdminNewBlogCategoryAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
+
+			$this->requireAdminPermission( "add_blog_category" );
         }
 
         /**

Modified: plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php	2006-11-11 14:28:07 UTC (rev 4278)
+++ plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php	2006-11-11 14:29:33 UTC (rev 4279)
@@ -39,6 +39,8 @@
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "editblogcategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_updating_article_category" ));
 			$this->setValidationErrorView( $errorView );
+			
+			$this->requireAdminPermission( "update_blog_category" );			
         }
 
         /**

Modified: plog/trunk/templates/admin/blogcategories.template
===================================================================
--- plog/trunk/templates/admin/blogcategories.template	2006-11-11 14:28:07 UTC (rev 4278)
+++ plog/trunk/templates/admin/blogcategories.template	2006-11-11 14:29:33 UTC (rev 4279)
@@ -45,15 +45,17 @@
       <input class="checkbox" type="checkbox" name="categoryIds[{counter}]" id="checks_{$blogcategory->getId()}" value="{$blogcategory->getId()}" />
    </td>  
    <td class="col_highlighted">
-    <a href="admin.php?op=editBlogCategory&amp;categoryId={$blogcategory->getId()}">{$blogcategory->getName()}</a>
+    {check_perms adminperm=update_blog_category}<a href="admin.php?op=editBlogCategory&amp;categoryId={$blogcategory->getId()}">{/check_perms}{$blogcategory->getName()}{check_perms adminperm=update_blog_category}{/check_perms}</a>
    </td>
    <td>
     {$blogcategory->getNumBlogs()}
    </td>	
    <td>
      <div class="list_action_button">
+	  {check_perms adminperm=update_blog_category}	
        <a href="?op=editBlogCategory&amp;categoryId={$blogcategory->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
        <a href="?op=deleteBlogCategory&amp;categoryId={$blogcategory->getId()}"><img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>
+      {/check_perms}
      </div>
    </td>
   </tr>
@@ -63,8 +65,10 @@
  </div>
  <div id="list_action_bar">
   {adminpager style=list}
+  {check_perms adminperm=update_blog_category}
   <input type="hidden" name="op" value="deleteBlogCategories"/>
   <input type="submit" name="Delete selected" value="{$locale->tr("delete")}"/>
+  {/check_perms}
  </div>
  </form>
 {include file="$admintemplatepath/footernavigation.template"}



More information about the pLog-svn mailing list