[pLog-svn] r4445 - plog/trunk/class/net/xmlrpc
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Dec 28 21:46:46 GMT 2006
Author: oscar
Date: 2006-12-28 21:46:46 +0000 (Thu, 28 Dec 2006)
New Revision: 4445
Modified:
plog/trunk/class/net/xmlrpc/xmlrpcserver.class.php
Log:
fixed the metaWeblogNewMediaObject method call and implemented permissions in it
Modified: plog/trunk/class/net/xmlrpc/xmlrpcserver.class.php
===================================================================
--- plog/trunk/class/net/xmlrpc/xmlrpcserver.class.php 2006-12-28 21:46:14 UTC (rev 4444)
+++ plog/trunk/class/net/xmlrpc/xmlrpcserver.class.php 2006-12-28 21:46:46 UTC (rev 4445)
@@ -1022,9 +1022,20 @@
$password = $args[2];
$file = $args[3];
- $auth = $users->authenticateUser($username,$password);
- if ($auth)
- {
+ $userInfo = $users->getUserInfo( $username, $password );
+ if( $userInfo ) {
+
+ // check if the blog id is valid
+ $blogInfo = $blogsG->getBlogInfo( $blogid );
+ if( !$blogInfo ) {
+ return new IXR_Error(-1, 'The blog is not valid' );
+ }
+
+ // and now check if the user has enough access to upload resources
+ if( !$this->userHasPermission( $userInfo, $blogInfo, "add_resource" )) {
+ return new IXR_Error(-1, 'This user does not have enough permissions' );
+ }
+
// Save this file to the tmp directory
// Create a temp file
@@ -1074,7 +1085,6 @@
// Get the resource from the id
$resource = $resources->getResource( $resId, $blogid, $albumArray[0]->getId() );
// Now we need to get the url for the resource
- $blogInfo = $blogsG->getBlogInfo( $blogid );
$url = $blogInfo->getBlogRequestGenerator();
$responseStruct = array();
More information about the pLog-svn
mailing list