[pLog-svn] r528 - plog/trunk/class/dao
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Fri Dec 17 16:34:59 GMT 2004
Author: oscar
Date: 2004-12-17 16:34:59 +0000 (Fri, 17 Dec 2004)
New Revision: 528
Modified:
plog/trunk/class/dao/userpermissions.class.php
Log:
added a method for updatng the list of users that have access to blog in one way or another
Modified: plog/trunk/class/dao/userpermissions.class.php
===================================================================
--- plog/trunk/class/dao/userpermissions.class.php 2004-12-17 16:29:05 UTC (rev 527)
+++ plog/trunk/class/dao/userpermissions.class.php 2004-12-17 16:34:59 UTC (rev 528)
@@ -267,6 +267,37 @@
return $result;
}
+ /**
+ * updates the list of users that have access to the blog. But this method works so
+ * that it first removes all current permissions and then recreates them again
+ * based on the given list of users
+ *
+ * @param blogId
+ * @param userIdList An associative array with user ids
+ * @return true if successful or false otherwise
+ */
+ function updateBlogUserPermissions( $blogId, $userList )
+ {
+ // first of all, remove all the permissions
+ $this->revokeBlogPermissions( $blogId );
+
+ // make sure that we're dealing with an array
+ if( !is_array( $userList )) {
+ $this->log->debug("userList is not an array!!");
+ return false;
+ }
+
+ // loop through the array and recreate the permissions
+ foreach( $userList as $userId ) {
+ if( $userId > 0 ) {
+ $this->grantPermission( $userId, $blogId, PERMISSION_BLOG_USER );
+ $this->log->debug("recreating permission for user $userId in blog $blogId" );
+ }
+ }
+
+ return true;
+ }
+
/**
* revokes all the permissions that a user may have
*
More information about the pLog-svn
mailing list