[pLog-svn] r6175 - in plugins/branches/lifetype-1.2/trash: . class/action class/view

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat Jan 26 15:47:45 EST 2008


Author: jondaley
Date: 2008-01-26 15:47:45 -0500 (Sat, 26 Jan 2008)
New Revision: 6175

Modified:
   plugins/branches/lifetype-1.2/trash/class/action/adminemptytrashaction.class.php
   plugins/branches/lifetype-1.2/trash/class/action/adminviewtrashaction.class.php
   plugins/branches/lifetype-1.2/trash/class/view/adminviewtrashview.class.php
   plugins/branches/lifetype-1.2/trash/plugintrash.class.php
Log:
permissions hadn't been updated from 1.1 properly

Modified: plugins/branches/lifetype-1.2/trash/class/action/adminemptytrashaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/trash/class/action/adminemptytrashaction.class.php	2008-01-26 20:46:41 UTC (rev 6174)
+++ plugins/branches/lifetype-1.2/trash/class/action/adminemptytrashaction.class.php	2008-01-26 20:47:45 UTC (rev 6175)
@@ -16,6 +16,11 @@
         {
             lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
         	$this->AdminAction( $actionInfo, $request );
+
+                // check various permissions.
+        	$this->requirePermission( 'add_post' );
+        	$this->requirePermission( 'view_posts' );
+        	$this->requirePermission( 'update_post' );
         	
 			// data validation stuff...
 			if( $request['postId'] ) {
@@ -60,20 +65,24 @@
                         continue;
                     }
                     
-				    if( $post->getUserId() == $this->_userInfo->getId() ) {
-                            // TODO: check if we have permission to update other's articles, instead of assuming we don't
-				        $result = $articles->deleteArticle( $postId, $post->getUser(), $this->_blogInfo->getId(), true);
+				    if( ($post->getUserId() == $this->_userInfo->getId()) ||
+                        $this->userHasPermission( "update_all_user_articles" ))
+                    {
+				        $result = $articles->deleteArticle( $postId, $post->getUser(),
+                                                            $this->_blogInfo->getId(), true);
 				    } else {
 				        $errorMessage .= $this->_locale->tr("error_can_only_update_own_articles")." ";
 				        $result = false;
 				    }
 				        
 				    if( !$result ) {
-				        $errorMessage .= $this->_locale->pr("error_deleting_article", $post->getTopic())."<br/>";
+				        $errorMessage .= $this->_locale->pr("error_deleting_article",
+                                                            $post->getTopic())."<br/>";
 				    } else {
 				        $totalOk++;
 				        if( $totalOk < 2 ) 
-				        	$successMessage = $this->_locale->pr("article_deleted_ok", $post->getTopic())."<br/>";
+				        	$successMessage = $this->_locale->pr("article_deleted_ok",
+                                                                 $post->getTopic())."<br/>";
 				        else
 				        	$successMessage = $this->_locale->pr("articles_deleted_ok", $totalOk );
 				    }

Modified: plugins/branches/lifetype-1.2/trash/class/action/adminviewtrashaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/trash/class/action/adminviewtrashaction.class.php	2008-01-26 20:46:41 UTC (rev 6174)
+++ plugins/branches/lifetype-1.2/trash/class/action/adminviewtrashaction.class.php	2008-01-26 20:47:45 UTC (rev 6175)
@@ -12,8 +12,10 @@
         function AdminViewTrashAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
-        	// Check permissions
-        	$this->requirePermission( 'manage_admin_plugins' );
+                // check various permissions.
+        	$this->requirePermission( 'add_post' );
+        	$this->requirePermission( 'view_posts' );
+        	$this->requirePermission( 'update_post' );
         }
 
         function perform()

Modified: plugins/branches/lifetype-1.2/trash/class/view/adminviewtrashview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/trash/class/view/adminviewtrashview.class.php	2008-01-26 20:46:41 UTC (rev 6174)
+++ plugins/branches/lifetype-1.2/trash/class/view/adminviewtrashview.class.php	2008-01-26 20:47:45 UTC (rev 6175)
@@ -28,6 +28,9 @@
             $blogId = $this->_blogInfo->getId();
             $userId = $this->_userInfo->getId();
 
+                // TODO: check $this->userHasPermission( "update_all_user_articles" ))
+                //       and show all articles for the blog?
+
 			$posts = $articles->getBlogArticles( $blogId, -1, $this->_itemsPerPage, 0, POST_STATUS_DELETED, $userId, 0, '', $this->_page);
 
 			// get the total number of posts

Modified: plugins/branches/lifetype-1.2/trash/plugintrash.class.php
===================================================================
--- plugins/branches/lifetype-1.2/trash/plugintrash.class.php	2008-01-26 20:46:41 UTC (rev 6174)
+++ plugins/branches/lifetype-1.2/trash/plugintrash.class.php	2008-01-26 20:47:45 UTC (rev 6175)
@@ -11,7 +11,7 @@
             $this->desc = "This plugin allows the post owner to remove deleted posts permanently";
             $this->author = "Ahmad Fathi Saleh (Al Bawaba Team)";
             $this->locale = "locale_en_UK";
-            $this->version = "20070907";
+            $this->version = "20080125";
             if( "admin" == $source ) {
                 $this->adminInit();
             }
@@ -28,7 +28,9 @@
 
             $menu =& Menu::getMenu();
             if( $menu->entryExists( "/menu/Manage/managePosts" ) ) {
-                $this->addMenuEntry( "/menu/Manage/managePosts", "trash", "admin.php?op=viewTrash", null, true, false );
+                $this->addMenuEntry( "/menu/Manage/managePosts", "trash",
+                                     "admin.php?op=viewTrash", null, array(),
+                                     array("view_posts", "add_post", "update_post"), false);
             }
         }
     }



More information about the pLog-svn mailing list