[wp-hackers] User Capabilities

Ryan Boren ryan at boren.nu
Fri Jul 8 21:34:41 GMT 2005


> > I've attached new files to try with changes that look to me like they
> > work.  It builds a complete list of caps when WP_User is created by
> > reading the user roles recursively.  Apply my patch over Ryan's and
> > replace the capabilities.php file with this new one.  You'll need to
> > delete the options table row that contains the roles and run the upgrade
> > to see the recursive roles work.
> >
> > Hint: echo $current_user->caps from admin-footer.php.
> 
> I'll give it a try when I get home.

I'm not sure about having roles reference other roles.  If a privilege
is removed for one role, the privilege is lost to higher roles as well.
If manage_links is removed for the Managing Editor, the Publisher loses
that priv as well unless it is separately added to the Publisher role.
I think each role should be self contained.

Also, if we expand the role caps into the user caps it is possible for
the user caps to get saved to the DB in this expanded state.  The user
caps will no longer reference a role and no longer reflect changes made
to the role.

Ryan



More information about the wp-hackers mailing list