[wp-hackers] User Capabilities

Ryan Boren ryan at boren.nu
Sun Jul 10 17:25:27 GMT 2005


On Sun, 2005-07-10 at 03:06 -0400, Owen Winkler wrote:
> Changes attached:
> * Replaced role recursion with flat role cap merge.
> * WP_User now has ->roles and ->allcaps.
> * Added WP_Roles::is_role() for checking if a string is a valid role name.
> * Added WP_User:: add_role(), remove_role(), and set_role() as per above.
> * Changed WP_User::remove_cap() so that you can't remove roles with it.
> * Changed add_cap() so that you can deny caps with it.
> * has_cap() returns true/false based on cap true/false state - user caps 
> override role caps.
> * Made update_user_cache() pluggable.
> * wp-settings.php now checks for db data using update_category_cache() 
> instead of update_user_cache().

Awesome.

> Has anyone else tried the patch?  If your plugin depends on user levels, 
> it might be a good idea to check out these changes before they get 
> committed.

For plugin back compat, we'll need to add some code that sets an
"equivalent user level" whenever we change a user's role.

> What changes will there be to the user admin UI?  How extensive will it 
> get?  I imagine that the only thing that *has* to be done is to use a 
> dropdown of roles in place of the numeric level gadget.  Oh, how sweet 
> that will be, finally!  (Sorted alphabetically?  No numbers anymore...)

I'd like to see that dropdown too.  Beyond that, I leave the UI design
to others.

Ryan




More information about the wp-hackers mailing list