Authentication and authorization
Wordpress features a complete user management system. It also features a system to manage authorization via Roles and capabilities.
Mouf on the other hand features an authentication system named UserService and a authorization system named RightsService. The rights service in Mouf has the notion of "right" that maps the notion of "capability" in Wordpress. The notion of "role" in Mouf is voluntarily absent (in order to allow developers to add whatever they want).
When you install Moufpress, the install process will create 2 instances related to authentication and authorization:
userService: an instance of the
MoufpressUserServiceclass that is compatible with the
rightsService: an instance of the
MoufpressRightServiceclass that is compatible with the
Many packages in Mouf rely on those 2 instances so installing those will allow those packages to integrate directly with Wordpress rights.
add_capWordpress function. You can also manage roles and capabilities using many well designed plugins like role-manager.
A few exemples of what you can do with these objects:
// Connects the user Mouf::getUserService()->login('login', 'password'); // Returns whether a user is connected or not $isLogged = Mouf::getUserService()->isLogged(); // Returns the login of the current logged user $login = Mouf::getUserService()->getUserLogin(); // Returns whether the logged user has rights to 'read' articles (mapping the 'read' capability in Wordpress) $isAllowed = Mouf::getRightsService()->isAllowed('read');
Found a typo? Something is wrong in this documentation? Just fork and edit it!