[pLog-svn] r3037 - plog/trunk/class/dao

oscar at devel.lifetype.net oscar at devel.lifetype.net
Mon Mar 6 16:16:23 GMT 2006


Author: oscar
Date: 2006-03-06 16:16:22 +0000 (Mon, 06 Mar 2006)
New Revision: 3037

Modified:
   plog/trunk/class/dao/userpermissions.class.php
Log:
do not add the blog owner to the list of users with access, as it is pointless


Modified: plog/trunk/class/dao/userpermissions.class.php
===================================================================
--- plog/trunk/class/dao/userpermissions.class.php	2006-03-06 16:15:51 UTC (rev 3036)
+++ plog/trunk/class/dao/userpermissions.class.php	2006-03-06 16:16:22 UTC (rev 3037)
@@ -171,14 +171,22 @@
             // first of all, remove all the permissions
             $this->revokeBlogPermissions( $blogId );
             
+            // load the blog to check whether it is there and to filter out
+            // the blog owner
+            include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+            $blogs = new Blogs();
+            $blog = $blogs->getBlogInfo( $blogId );
+            if( !$blog )
+            	return false;
+            
             // make sure that we're dealing with an array
-            if( !is_array( $userList )) {
+            if( !is_array( $userList )) {	            
                 return false;
             }
             
             // loop through the array and recreate the permissions
             foreach( $userList as $userId ) {
-                if( $userId > 0 ) {
+                if( $userId > 0 && $blog->getOwnerId() != $userId ) {
 					$perm = new UserPermission( $userId, $blogId, PERMISSION_BLOG_USER );
 					$this->grantPermission( $perm );
                 }



More information about the pLog-svn mailing list