Source for file UserRights.php
Documentation is available at UserRights.php
require_once 'index.php';
echo '<h3>UserRights</h3>';
$users = $admin->getUsers (array ('container' => 'auth'));
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($users)) {
echo 'Run the <strong>User</strong> test first<br />';
$rights = $admin->perm ->getRights ();
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($rights)) {
echo 'Run the <strong>Right</strong> test first<br />';
for ($i = 1; $i < 30; $i++ ) {
'perm_user_id' => $users[$user]['perm_user_id'],
'right_id' => $rights[$right]['right_id'],
$granted = $admin->perm ->grantUserRight ($data);
if ($granted === false ) {
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
echo '<strong>' . $users[$user]['name'] . '</strong> was granted the right <strong>' . $rights[$right]['right_id'] . '</strong><br />';
'perm_user_id' => $users[$user]['auth_user_id'],
'right_id' => $rights[$right]['right_id']
$revoked = $admin->perm ->revokeUserRight ($filters);
if ($revoked === false ) {
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
echo 'The right <strong>' . $rights[$right]['right_id'] . '</strong> has been revoked from <strong>' . $users[$user]['name'] . '</strong><br />';
'perm_user_id' => $users[$user]['perm_user_id']
$user_rights = $admin->perm ->getRights ($params);
if ($user_rights === false ) {
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($user_rights)) {
echo 'No rights were found for perm user id <strong>' . $users[$user]['perm_user_id'] . '</strong><br />';
'perm_user_id' => $users[$user]['auth_user_id'],
'right_id' => $user_rights[$right]['right_id']
$data = array ('right_level' => 3 );
$update = $admin->perm ->updateUserRight ($data, $filters);
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
echo 'The right <strong>' . $user_rights[$right]['right_id'] . '</strong> has been updated to Level 3 for <strong>' . $users[$user]['name'] . '</strong><br />';
'right_id' => $user_rights[$right]['right_id'],
'perm_user_id' => $users[$user]['perm_user_id']
$result = $admin->perm ->getRights ($params);
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($result)) {
echo 'No result came from searching for right id <strong>' . $user_rights[$right]['right_id'] . '</strong>
and perm user id <strong>' . $users[$user]['perm_user_id'] . '</strong><br />';
Var_Dump ::display ($result);
'perm_user_id' => $users[$user]['perm_user_id']
$singleRight = $admin->perm ->getRights ($params);
if ($singleRight === false ) {
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($singleRight)) {
echo 'No rights were found for perm user id <strong>' . $users[$user]['perm_user_id'] . '</strong><br />';
echo 'These are the user rights for <strong>' . $users[$user]['perm_user_id'] . '</strong>:<br />';
Var_Dump ::display ($singleRight);
$rights = $admin->perm ->getRights ($params);
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($rights)) {
echo 'No rights were found.<br />';
echo 'Here are all the rights:<br />';
Var_Dump ::display ($rights);
Documentation generated on Mon, 11 Mar 2019 15:39:44 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|