Make WordPress Core


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.