Make WordPress Core

Changeset 31658


Ignore:
Timestamp:
03/07/2015 05:59:17 AM (10 years ago)
Author:
jeremyfelt
Message:

Return HTTP status code 403 in network admin when access is forbidden.

When the error message "You do not have permission to access this page" is used in network admin screens, return an HTTP status code of 403 to match. Previously: [30356] and [31300].

Props yo-l1982.

Fixes #31422.

Location:
trunk/src/wp-admin/network
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/index.php

    r27469 r31658  
    1818
    1919if ( ! current_user_can( 'manage_network' ) )
    20     wp_die( __( 'You do not have permission to access this page.' ) );
     20    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    2121
    2222$title = __( 'Dashboard' );
  • trunk/src/wp-admin/network/settings.php

    r31517 r31658  
    1818
    1919if ( ! current_user_can( 'manage_network_options' ) )
    20     wp_die( __( 'You do not have permission to access this page.' ) );
     20    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    2121
    2222$title = __( 'Network Settings' );
  • trunk/src/wp-admin/network/site-info.php

    r31517 r31658  
    4141$details = get_blog_details( $id );
    4242if ( !can_edit_network( $details->site_id ) )
    43     wp_die( __( 'You do not have permission to access this page.' ) );
     43    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    4444
    4545$parsed = parse_url( $details->siteurl );
  • trunk/src/wp-admin/network/site-settings.php

    r31517 r31658  
    4141$details = get_blog_details( $id );
    4242if ( !can_edit_network( $details->site_id ) )
    43     wp_die( __( 'You do not have permission to access this page.' ) );
     43    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    4444
    4545$is_main_site = is_main_site( $id );
  • trunk/src/wp-admin/network/site-themes.php

    r31200 r31658  
    5858$details = get_blog_details( $id );
    5959if ( !can_edit_network( $details->site_id ) )
    60     wp_die( __( 'You do not have permission to access this page.' ) );
     60    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    6161
    6262$is_main_site = is_main_site( $id );
  • trunk/src/wp-admin/network/site-users.php

    r31517 r31658  
    5151$details = get_blog_details( $id );
    5252if ( ! can_edit_network( $details->site_id ) )
    53     wp_die( __( 'You do not have permission to access this page.' ) );
     53    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    5454
    5555$is_main_site = is_main_site( $id );
  • trunk/src/wp-admin/network/sites.php

    r31200 r31658  
    1515
    1616if ( ! current_user_can( 'manage_sites' ) )
    17     wp_die( __( 'You do not have permission to access this page.' ) );
     17    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    1818
    1919$wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' );
     
    9898        case 'deleteblog':
    9999            if ( ! current_user_can( 'delete_sites' ) )
    100                 wp_die( __( 'You do not have permission to access this page.' ) );
     100                wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    101101
    102102            $updated_action = 'not_deleted';
  • trunk/src/wp-admin/network/upgrade.php

    r30029 r31658  
    3737
    3838if ( ! current_user_can( 'manage_network' ) )
    39     wp_die( __( 'You do not have permission to access this page.' ) );
     39    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    4040
    4141echo '<div class="wrap">';
  • trunk/src/wp-admin/network/user-new.php

    r31517 r31658  
    3434    check_admin_referer( 'add-user', '_wpnonce_add-user' );
    3535    if ( ! current_user_can( 'manage_network_users' ) )
    36         wp_die( __( 'You do not have permission to access this page.' ) );
     36        wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    3737
    3838    if ( ! is_array( $_POST['user'] ) )
  • trunk/src/wp-admin/network/users.php

    r31656 r31658  
    1515
    1616if ( ! current_user_can( 'manage_network_users' ) )
    17     wp_die( __( 'You do not have permission to access this page.' ) );
     17    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    1818
    1919function confirm_delete_users( $users ) {
     
    124124        case 'deleteuser':
    125125            if ( ! current_user_can( 'manage_network_users' ) )
    126                 wp_die( __( 'You do not have permission to access this page.' ) );
     126                wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    127127
    128128            check_admin_referer( 'deleteuser' );
     
    145145        case 'allusers':
    146146            if ( !current_user_can( 'manage_network_users' ) )
    147                 wp_die( __( 'You do not have permission to access this page.' ) );
     147                wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    148148
    149149            if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) {
     
    158158                            case 'delete':
    159159                                if ( ! current_user_can( 'delete_users' ) )
    160                                     wp_die( __( 'You do not have permission to access this page.' ) );
     160                                    wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    161161                                $title = __( 'Users' );
    162162                                $parent_file = 'users.php';
     
    207207            check_admin_referer( 'ms-users-delete' );
    208208            if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) )
    209                 wp_die( __( 'You do not have permission to access this page.' ) );
     209                wp_die( __( 'You do not have permission to access this page.' ), '', array( 'response' => 403 ) );
    210210
    211211            if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.