Changeset 3846

Show
Ignore:
Timestamp:
06/05/06 16:52:21 (3 years ago)
Author:
ryan
Message:

Add more fine grained user management caps. Part 1. #2775

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-functions.php

    r3822 r3846  
    739739    $r .= "\n\t\t<td align='center'>$numposts</td>"; 
    740740    $r .= "\n\t\t<td>"; 
    741     if (current_user_can('edit_users')
     741    if ( current_user_can('edit_user', $user_object->ID)
    742742        $r .= "<a href='user-edit.php?user_id=$user_object->ID' class='edit'>".__('Edit')."</a>"; 
    743743    $r .= "</td>\n\t</tr>"; 
  • trunk/wp-admin/upgrade-functions.php

    r3772 r3846  
    174174        upgrade_160(); 
    175175 
    176     if ( $wp_current_db_version < 3767
     176    if ( $wp_current_db_version < 3845
    177177        upgrade_210(); 
    178178 
     
    493493    } 
    494494 
    495     if ( $wp_current_db_version < 3767 ) { 
     495    if ( $wp_current_db_version < 3845 ) { 
    496496        populate_roles_210(); 
    497497    } 
  • trunk/wp-admin/upgrade-schema.php

    r3810 r3846  
    365365    } 
    366366 
     367    $role = get_role('administrator'); 
     368    if ( ! empty($role) ) { 
     369        $role->add_cap('delete_users'); 
     370        $role->add_cap('create_users'); 
     371    } 
     372 
    367373    $role = get_role('author'); 
    368374    if ( ! empty($role) ) { 
  • trunk/wp-admin/user-edit.php

    r3839 r3846  
    3535check_admin_referer('update-user_' . $user_id); 
    3636 
    37 if (!current_user_can('edit_users')
     37if ( !current_user_can('edit_user', $user_id)
    3838    $errors = new WP_Error('head', __('You do not have permission to edit this user.')); 
    3939else 
     
    5050$profileuser = new WP_User($user_id); 
    5151 
    52 if (!current_user_can('edit_users')
     52if ( !current_user_can('edit_user', $user_id)
    5353    if ( !is_wp_error( $errors ) ) 
    5454        $errors = new WP_Error('head', __('You do not have permission to edit this user.')); 
  • trunk/wp-admin/users.php

    r3788 r3846  
    2424    $update = 'promote'; 
    2525    foreach($userids as $id) { 
     26        if ( ! current_user_can('edit_user', $id) ) 
     27            die(__('You can&#8217;t edit that user.')); 
    2628        // The new role of the current user must also have edit_users caps 
    2729        if($id == $current_user->id && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) { 
     
    4648    } 
    4749 
    48     if ( !current_user_can('edit_users') ) 
     50    if ( !current_user_can('delete_users') ) 
    4951        die(__('You can&#8217;t delete users.')); 
    5052 
     
    5355    $update = 'del'; 
    5456    foreach ($userids as $id) { 
     57        if ( ! current_user_can('delete_user', $id) ) 
     58            die(__('You can&#8217;t delete that user.')); 
     59  
    5560        if($id == $current_user->id) { 
    5661            $update = 'err_admin_del'; 
     
    7984    } 
    8085 
    81     if ( !current_user_can('edit_users') ) 
     86    if ( !current_user_can('delete_users') ) 
    8287        $error = new WP_Error('edit_users', __('You can&#8217;t delete users.')); 
    8388 
     
    135140    check_admin_referer('add-user'); 
    136141 
     142    if ( ! current_user_can('create_users') ) 
     143        die(__('You can&#8217;t create users.')); 
     144 
    137145    $user_id = add_user(); 
    138146    if ( is_wp_error( $user_id ) ) 
  • trunk/wp-includes/capabilities.php

    r3772 r3846  
    273273 
    274274    switch ($cap) { 
     275    case 'delete_user': 
     276        $caps[] = 'delete_users'; 
     277        break; 
     278    case 'edit_user': 
     279        $caps[] = 'edit_users'; 
     280        break; 
    275281    case 'delete_post': 
    276282        $author_data = get_userdata($user_id); 
  • trunk/wp-includes/version.php

    r3810 r3846  
    33// This just holds the version number, in a separate file so we can bump it without cluttering the SVN 
    44 
    5 $wp_version = '2.1-alpha1'; 
    6 $wp_db_version = 3809
     5$wp_version = '2.1-alpha2'; 
     6$wp_db_version = 3845
    77 
    88?>