[pLog-svn] r4330 - plog/trunk
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Fri Nov 24 18:42:42 GMT 2006
Author: oscar
Date: 2006-11-24 18:42:41 +0000 (Fri, 24 Nov 2006)
New Revision: 4330
Modified:
plog/trunk/wizard.php
Log:
now the first user that is added gets all the admin permissions necessary
Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php 2006-11-24 18:40:49 UTC (rev 4329)
+++ plog/trunk/wizard.php 2006-11-24 18:42:41 UTC (rev 4330)
@@ -64,6 +64,10 @@
include_once( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/permission.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/userpermission.class.php" );
// table schemas
include_once( PLOG_CLASS_PATH."install/dbschemas.properties.php" );
@@ -1115,9 +1119,18 @@
return false;
}
- // we also have to execute the code to give administrator privileges to this user
- $query = "INSERT INTO {$dbPrefix}users_permissions(user_id,blog_id,permission_id) VALUES( $userId, 0, 1 );";
- $db->Execute( $query );
+ // since this user is an administrator, he must be granted all the administrator
+ // permissions available
+ $perms = new Permissions();
+ $userPerms = new UserPermissions();
+ foreach( $perms->getAllPermissions() as $perm ) {
+ if( $perm->isAdminOnlyPermission()) {
+ // if it's an admin permission, add it
+ $p = new UserPermission( $userId, 0, $perm->getId());
+ $userPerms->grantPermission( $p );
+ print("granting permission: ".$perm->getName()."<br/>");
+ }
+ }
$this->_view = new Wizardview( "step4" );
$this->_view->setValue( "ownerid", $userId );
More information about the pLog-svn
mailing list