User Overview
This is not Alpha's spec, but Beta's spec.
Description
XOOPS Cube has different permission design from XOOPS2. That's the role base. Modules can check roles of the current user through the context object. 'module_read' and 'module_admin' of XOOPS2 permissions are converted to roles. You can check a permission by the groupperm handler also, but you should use the new style.
Where is the principal object?
You can access the principal object with the context object. The context object has many informations of the current access. At first, you need to get the XCube_Root object.
$root =& XCube_Root::getSingleton();
Next, you may access the principal object through the context object which is a property of the root.
$root->mContext->mUser...
If you can access the controller object, you may get the principal with the following method.
$controller->mRoot->mContext->mUser...
System roles
When Legacy with the user module keeps a user login, system roles are added to the current principal object. $xoopsUser is not good to check its permission, because it's null for anonymous users. But, the principal object is active for blocks and modules anytime.
Site.GuestUser
This is a special role for anonymous users.
/* XOOPS2 Style */ if (!is_object($xoopsUser)) .... /* Cube Style */ $root =& XCube_Root::getSingleton(); if ($root->mContext->mUser->isInRole('Site.GuestUser')) ...
Site.RegisteredUser
This is a special role for registered users. This role is gived to a registered user, whether he belongs to XOOPS_GROUP_USERS.
Module roles
When the current user accesses to modules, Legacy loads his permissions with the groupperm handler and converts loaded permissions to roles. Therefore, Legacy sets roles about modules automatically for the current modules only.
Module.{dirname}.Visitor
This role is given to a user belonging to the group which has 'module_read'.
Page Info | |
---|---|
Page Name : | XOOPSCubeLegacy/Reference/UserOverview |
Page aliases : | None |
Page owner : | Anonymous |
Can Read | |
Groups : | All visitors |
Users : | All visitors |
Can Edit | |
Groups : | Support Site Webmasters |
Users : | No one |