From 8a682722d1b64ba299997ff3f6099db353fab43a Mon Sep 17 00:00:00 2001 From: donncha Date: Fri, 15 Jul 2005 11:12:16 +0000 Subject: Merge from WP SVN. git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@27 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-inst/xmlrpc.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'wp-inst/xmlrpc.php') diff --git a/wp-inst/xmlrpc.php b/wp-inst/xmlrpc.php index a00abc0..6326596 100644 --- a/wp-inst/xmlrpc.php +++ b/wp-inst/xmlrpc.php @@ -157,8 +157,8 @@ class wp_xmlrpc_server extends IXR_Server { return $this->error; } - $user_data = get_userdatabylogin($user_login); - $is_admin = $user_data->user_level > 3; + $user = new WP_User($user_login); + $is_admin = $user->has_cap('level_8'); $struct = array( 'isAdmin' => $is_admin, @@ -295,10 +295,9 @@ class wp_xmlrpc_server extends IXR_Server { return $this->error; } - $user_data = get_userdatabylogin($user_login); - - if ($user_data->user_level < 3) { - return new IXR_Error(401, 'Sorry, users whose level is less than 3, can not edit the template.'); + $user = new WP_User($user_login); + if ( !$user->has_cap('edit_themes') ) { + return new IXR_Error(401, 'Sorry, this user can not edit the template.'); } /* warning: here we make the assumption that the weblog's URI is on the same server */ @@ -331,10 +330,9 @@ class wp_xmlrpc_server extends IXR_Server { return $this->error; } - $user_data = get_userdatabylogin($user_login); - - if ($user_data->user_level < 3) { - return new IXR_Error(401, 'Sorry, users whose level is less than 3, can not edit the template.'); + $user = new WP_User($user_login); + if ( !$user->has_cap('edit_themes') ) { + return new IXR_Error(401, 'Sorry, this user can not edit the template.'); } /* warning: here we make the assumption that the weblog's URI is on the same server */ @@ -849,9 +847,9 @@ class wp_xmlrpc_server extends IXR_Server { return $this->error; } - if(get_settings('fileupload_minlevel') > $user_data->user_level) { - // User has not enough privileges - logIO('O', '(MW) Not enough privilege: user level too low'); + $user = new WP_User($user_login); + if ( !$user->has_cap('upload_files') ) { + logIO('O', '(MW) User does not have upload_files capability'); $this->error = new IXR_Error(401, 'You are not allowed to upload files to this site.'); return $this->error; } @@ -1310,4 +1308,4 @@ class wp_xmlrpc_server extends IXR_Server { $wp_xmlrpc_server = new wp_xmlrpc_server(); -?> \ No newline at end of file +?> -- cgit