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

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Oct 29 18:19:54 GMT 2006


Author: oscar
Date: 2006-10-29 18:19:53 +0000 (Sun, 29 Oct 2006)
New Revision: 4211

Modified:
   plog/trunk/class/action/admin/adminaddbloguseraction.class.php
   plog/trunk/class/action/admin/adminupdatebloguseraction.class.php
Log:
replaced revokeBlogPermissions() with revokePermissions(), or else updating the user permissions in a blog would delete all permissions assigned to users.


Modified: plog/trunk/class/action/admin/adminaddbloguseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddbloguseraction.class.php	2006-10-29 18:12:26 UTC (rev 4210)
+++ plog/trunk/class/action/admin/adminaddbloguseraction.class.php	2006-10-29 18:19:53 UTC (rev 4211)
@@ -83,9 +83,11 @@
 
             // get the permissions that this user will be granted
             $userPerms = new UserPermissions();
-			foreach( $this->_perms as $val => $permId ) {
-	            $perm = new UserPermission( $userInfo->getId(), $this->_blogInfo->getId(), $permId );
-	            $res = $userPerms->grantPermission( $perm );
+			if( is_array( $this->_perms )) {
+				foreach( $this->_perms as $val => $permId ) {
+	                $perm = new UserPermission( $userInfo->getId(), $this->_blogInfo->getId(), $permId );
+	                $res = $userPerms->grantPermission( $perm );
+				}
 			}
 			
 			$this->notifyEvent( EVENT_PRE_USER_UPDATE, Array( "user" => &$userInfo ));

Modified: plog/trunk/class/action/admin/adminupdatebloguseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatebloguseraction.class.php	2006-10-29 18:12:26 UTC (rev 4210)
+++ plog/trunk/class/action/admin/adminupdatebloguseraction.class.php	2006-10-29 18:19:53 UTC (rev 4211)
@@ -52,12 +52,14 @@
 			
 			// first revoke all permissions
 			$userPerms = new UserPermissions();
-			$userPerms->revokeBlogPermissions( $this->_blogInfo->getId());
+			$userPerms->revokePermissions( $userInfo->getId(), $this->_blogInfo->getId());
 			
 			// and then assign the new ones
-			foreach( $this->_perms as $val => $permId ) {
-	            $perm = new UserPermission( $userInfo->getId(), $this->_blogInfo->getId(), $permId );
-	            $res = $userPerms->grantPermission( $perm );
+			if( is_array( $this->_perms )) {
+				foreach( $this->_perms as $val => $permId ) {
+		            $perm = new UserPermission( $userInfo->getId(), $this->_blogInfo->getId(), $permId );
+		            $res = $userPerms->grantPermission( $perm );
+				}
 			}
 			
 			$this->notifyEvent( EVENT_POST_USER_UPDATE, Array( "user" => &$user ));			



More information about the pLog-svn mailing list