 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
gaorellana
Joined: 28 Feb 2007 Posts: 2
|
Posted: Wed Feb 28, 2007 1:00 am Post subject: How to get the Rights linked to a specific group |
|
|
Hi all,
I am using LiveUser_Admin and given I didnīt found an Admin GUI for it, I am doing it by myself.
Anyway, the point is that I want to be able to display for a specified group what rights are granted. I wonder if there's a method or function to get this.
I am using the Complex permission configuration. My function look mlike this but when I get $res as below, $res returns me all rights feined instead of only those for my $group ($group->getId()) retunrs the value of 'group_id' field of liveuser_groups table).
| Code: |
function getRightsForGroup($group)
{
$params=array(
'group_id'=>$group->getId()
);
$res=$this->admin->getRights($params);
$rights=array();
for($i=0;$i<count($res);$i++)
{
$rights[]=$dao->make($res[$i]);
}
$ok=$this->evaluate($rights,'getRightsForGroup');
if($ok)
return $rights;
else
return 0;
}
|
Thanks |
|
| Back to top |
|
 |
gaorellana
Joined: 28 Feb 2007 Posts: 2
|
Posted: Wed Feb 28, 2007 5:38 am Post subject: |
|
|
I found myself the answer, but I would like to make a contribution for somebody that could face the same problem
the key is in how we define the $params array of the function admin->getRights($params). The key 'selectable_tables' tells LiveUserAdmin which tables should join to get the job done.
Sorry for the excessive tabbing, but I cant get better formattin for the code in this page.
| Code: | function getRightsForGroup($group)
{
/*parameter array */
$params=array(
'container'=>'perm',
'filters'=>array(
'group_id'=>$group->getId()
),
'by_group'=>1,
'selectable_tables'=>array(
'rights',
'grouprights'
)
);
$res=$this->admin->getRights($params);
$dao=new RightDao();
$rights=array();
for($i=0;$i<count($res);$i++)
{
$rights[]=$dao->make($res[$i]);
}
$ok=$this->evaluate($rights,'getRightsForGroup');
if($ok)
return $rights;
else
return 0;
} |
Regards |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|