1
Codyko
Use of $gperm_handler->checkRight ?
  • 2005/11/4 3:42

  • Codyko

  • Just popping in

  • Posts: 22

  • Since: 2005/8/5 7


Hi!

I asked a question regarding group permission in my clinic module in the post :

https://xoops.org/modules/newbb/viewtopic.php?topic_id=12230&start=20#forumpost187979

I found the answers by self. But now I have another question that I could not find answers in other threads.

Ok, I have implemented an admin page which controls group permissions of my module. I can see that it adds entries to the "group_permission" table smoothly.

My problem is that following code could not grant access rights to "anonymous group" although I have appropriatly granted permissions to this group in the admin page :

$gperm_handler->checkRight($perm_name, $perm_itemid, $groups, $module_id)

However, it can correctly check access rights of other groups , which are granted in the admin page.

Any idea ?

2
Codyko
Re: Use of $gperm_handler->checkRight ?
  • 2005/11/4 4:12

  • Codyko

  • Just popping in

  • Posts: 22

  • Since: 2005/8/5 7


Here is additional information of my question:

A screen shot of the content of xoops_group_permission table

[pre]
mysqlselect from xoops_group_permission where gperm_modid AND gperm_groupid =AND gperm_itemid 3;
+----------+---------------+--------------+-------------+--------------+
gperm_id gperm_groupid gperm_itemid gperm_modid gperm_name   |
+----------+---------------+--------------+-------------+--------------+
|      
363 |             |            |           xclinic_view |
|      
408 |             |            |           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

Login

Who's Online

346 user(s) are online (255 user(s) are browsing Support Forums)


Members: 0


Guests: 346


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits