2
Here is additional information of my question:
A screen shot of the content of xoops_group_permission table
[pre]
mysql> select * from xoops_group_permission where gperm_modid = 9 AND gperm_groupid =3 AND gperm_itemid = 3;
+----------+---------------+--------------+-------------+--------------+
| gperm_id | gperm_groupid | gperm_itemid | gperm_modid | gperm_name |
+----------+---------------+--------------+-------------+--------------+
| 363 | 3 | 3 | 9 | xclinic_view |
| 408 | 3 | 3 | 9 | xclinic_add |
+----------+---------------+--------------+-------------+--------------+
2 rows in set (0.00 sec)
[/pre]
I suppose the following codes could check access rights of "ANONYMOUS" group correctly, since I have an entry "3" ( groupid of anonymous ) in thegperm_groupid :
[pre]
$perm_name = "xclinic_view";
$perm_itemid = 3;
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
$module_id = $xoopsModule->getVar('mid');
$gperm_handler = & xoops_gethandler('groupperm');
if (!$gperm_handler->checkRight($perm_name, $perm_itemid, $groups, $module_id)) {
redirect_header("index.php", 2, _MD_NOACCESSRIGHTS);
exit();
} else { //some actions here }
[/pre]
but it still redirects me to index.php if I visit the page as anonymous user