RE: checkRight function on the LiveUser object
"Jan Bolmeson" <[email protected]>
| Newsgroups | gmane.comp.php.pear.liveuser |
|---|---|
| Message-ID | <[email protected]> |
This is a printout where the code precedes the print out of the result on
every test and my reasoning in every step.
---------------------------------------------------------------------
Get all users in group 2: Here it is verified that the user with perm_id 3
is a member of group with id 2.
$params = array(
'filters' => array(
'group_id' => 2
)
);
$usersGroup = $this->admin->perm->getUsers($params);
array(1) {
0 => array(4) {
perm_user_id => string(1) 3
auth_user_id => string(1) 3
auth_container_name => string(2) DB
perm_type => string(1) 3
}
}
---------------------------------------------------------------------
Get all rights assigned to group 2: Here it is verified that the group with
id 2 has got the right with right id 2 (qslaw_Administration_ACCESS)
$params = array(
'fields' => array(
'right_id',
'right_define_name',
),
'with' => array(
'group_id' => array(
'fields' => array(
'group_id'
),
),
),
'filters' => array(
'group_id' => 2
),
//'limit' => 100,
//'offset' => 0,
);
return $this->admin->perm->getRights($params);
array(1) {
2 => array(4) {
right_id => string(1) 2
right_define_name => string(6) ACCESS
group_id => string(1) 2
groups => array(1) {
0 => array(1) {
group_id => string(1) 2
}
}
}
}
---------------------------------------------------------------------
Output rights constants:
array(2) {
qslaw_Administration_ACCESS => string(1) 2
qslaw_Administration_READ => string(1) 3
}
---------------------------------------------------------------------
Get user rights on user with perm_id 3: (here the user with perm_id
3 is verified to have the right_id 3 (qslaw_Administration_READ). Hence
At this point it should be clear that the user is granted right with id 3 as
a "userright" and right with id 2 as a "groupright"
$params = array(
'fields' => array(
'right_id',
'right_level'
),
'filters' => array(
'perm_user_id' => 3
)
);
print_r($admin->perm->getRights($params) );
array(1) {
3 => array(2) {
right_id => string(1) 3
right_level => string(1) 1
}
}
---------------------------------------------------------------------
Update property($LU->updateProperty($LU->_auth, $LU->_perm))
bool true
---------------------------------------------------------------------
$LU->getProperty('rights'):
array(0)
---------------------------------------------------------------------
$LU->getProperty('groupRights'):
NULL
---------------------------------------------------------------------
$LU->getProperty('groupIds'):
array(0)
---------------------------------------------------------------------
$LU->getProperty('userRights'):
array(0)
---------------------------------------------------------------------
$LU->checkRight(3):
bool false
---------------------------------------------------------------------
$LU->checkRight(3):
bool false
---------------------------------------------------------------------
$_SESSION to be verifid that the correct user with the correct auth_user_id
and hence the correct perm_user_id is logged in. Below shows that authUserId
is 3 which can be compared to test 1 which proves the relationship:
Auth_user_id = perm_user_id = 3
array(2) {
ludata => array(4) {
auth => array(17) {
handle => string(6) madwax
authUserId => string(1) 3
isActive => bool true
loggedIn => bool true
lastLogin => string(0)
currentLogin => int 1119257154
ownerGroupId => NULL
ownerUserId => NULL
storedExternalValues => NULL
firstname => string(3) Jan
lastname => string(8) Bolmeson
company_id => string(1) 1
email => string(15) [email protected]
name => string(12) Jan Bolmeson
username => string(6) madwax
id => string(1) 3
companyName => string(6) Ivtaco
}
auth_name => string(2) DB
perm => bool true
idle => int 1119259315
}
}
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Lukas Smith
Sent: den 20 juni 2005 11:08
To: LiveUser-DevList
Subject: Re: [LiveUser] checkRight function on the LiveUser object
yes .. so the mapping works. and you are sure that the perm_user_id 3 is
a member of a group that has rights associated, yet
getProperty('rights') gives you an empty array?
regards,
Lukas Smith
[email protected]