WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #2787


Ignore:
Timestamp:
06/04/06 23:03:22 (9 years ago)
Author:
markjaquith
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2787

    • Property Owner changed from anonymous to markjaquith
    • Property Status changed from new to assigned
  • Ticket #2787 – Description

    initial v1  
    11This idea came from a conversation I had with Ryan in #wordpress-dev 
    22 
    3 '''The Problem''' 
     3= The Problem = 
     4 
    45The role/cap system is hindered by having much of its data buried in arrays.  User2cap is ridiculous. 
    56 
    6 '''The Solution''' 
     7= The Solution = 
     8 
    79Roles are meaningless.  Getting users who have role X proves nothing, because they could have extra capabilities.  Capabilities are the thing you want. ''''Roles are just a capability container... a short way of granting a bunch of capabilities to a user.''''  Once you realize that, you see that what you really need is a cap2users table, that could double as a users2cap table.  That gives you one-query access to "what users can do X?" and "What can user X do?" 
    810 
    9 '''How Roles Fit In''' 
     11= How Roles Fit In = 
     12 
    1013In order for the role2cap table to be correct, it would need to be updated whenever: 
    1114 
     
    1821So we'd need a solid API for this.  This is the heavy lifting... done only when something is changed on the back end (infrequent). 
    1922 
    20 '''Schema''' 
     23= Schema = 
    2124 
    2225 * $wpdb->user2cap (per blog) 
    23  * * u2cid 
    24  * * user_id 
    25  * * cap_id 
    26  * * extra_cap 
     26   * u2cid 
     27   * user_id 
     28   * cap_id 
     29   * extra_cap 
    2730 
    2831extra_cap would be a binary flag.  Basically, it would say whether or not this cap is associated with a role or not.  It would be used on the backend.  The scenario is this: 
     
    3134 
    3235 * $wpdb->usermeta (multiple blogs can share this) 
    33  * * wp_role => Administrator 
    34  * * wp_otherblog_role => Garbage Collector 
    35  * * wp_otherblog_role => Little League Coach 
     36   * wp_role => Administrator 
     37   * wp_otherblog_role => Garbage Collector 
     38   * wp_otherblog_role => Little League Coach 
    3639 
    3740Note that a usermeta table can have roles for that user on different blogs and that there can be multiple roles for each user, even on the same blog.  That just means that cap2user has all the capabilities of all the roles that the user has, along with all extra caps (marked with extra_cap = 1). 
     
    3942The array that stores the Role => Cap information could stay as an array.  It would only be used in API functions on the back end. 
    4043 
    41 Original conversation. 
     44= Original conversation = 
    4245 
    4346{{{