cvs: pear /LiveUser_Admin/docs/examples/example1 Area_Admin_Areas.php ImplyRights.php User.php UserGroup.php UserRights.php

From: Date: Tue, 11 Apr 2006 16:53:30 +0000
Subject: cvs: pear /LiveUser_Admin/docs/examples/example1 Area_Admin_Areas.php ImplyRights.php User.php UserGroup.php UserRights.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-39551@lists.php.net to get a copy of this message
lsmith Tue Apr 11 16:53:30 2006 UTC Modified files: /pear/LiveUser_Admin/docs/examples/example1 Area_Admin_Areas.php ImplyRights.php User.php UserGroup.php UserRights.php Log: - updated API calls http://cvs.php.net/viewcvs.cgi/pear/LiveUser_Admin/docs/examples/example1/Area_Admin_Areas.php?r1=1.2&r2=1.3&diff_format=u Index: pear/LiveUser_Admin/docs/examples/example1/Area_Admin_Areas.php diff -u pear/LiveUser_Admin/docs/examples/example1/Area_Admin_Areas.php:1.2 pear/LiveUser_Admin/docs/examples/example1/Area_Admin_Areas.php:1.3 --- pear/LiveUser_Admin/docs/examples/example1/Area_Admin_Areas.php:1.2 Sun Apr 9 13:11:37 2006 +++ pear/LiveUser_Admin/docs/examples/example1/Area_Admin_Areas.php Tue Apr 11 16:53:29 2006 @@ -20,7 +20,7 @@ exit; } -$users = $admin->getUsers('perm', array('filters' => array('perm_type' => '3'))); +$users = $admin->getUsers(array('filters' => array('perm_type' => '3'))); if ($users === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; print_r($admin->getErrors()); http://cvs.php.net/viewcvs.cgi/pear/LiveUser_Admin/docs/examples/example1/ImplyRights.php?r1=1.2&r2=1.3&diff_format=u Index: pear/LiveUser_Admin/docs/examples/example1/ImplyRights.php diff -u pear/LiveUser_Admin/docs/examples/example1/ImplyRights.php:1.2 pear/LiveUser_Admin/docs/examples/example1/ImplyRights.php:1.3 --- pear/LiveUser_Admin/docs/examples/example1/ImplyRights.php:1.2 Fri Dec 2 12:41:27 2005 +++ pear/LiveUser_Admin/docs/examples/example1/ImplyRights.php Tue Apr 11 16:53:29 2006 @@ -8,9 +8,9 @@ exit; } echo '<hr />'; - +/* // add -for ($i = 0; $i < 25; $i++) { +for ($i = 0; $i < 5; $i++) { $right = array_rand($rights); $imright = array_rand($rights); $data = array( @@ -26,6 +26,60 @@ implied right from <strong>'. $rights[$right]['right_id'] .'</strong><br />'; } } + +$right_id = $rights[$right]['right_id']; +// view all with hierarchy +echo 'All the rights with hierarchy:<br />'; +$rights = $admin->perm->getRights(array( + 'hierarchy' => true, + 'rekey' => true, + 'filters' => array('right_id' => $right_id) +)); +if ($rights === false) { + echo '<strong>Error on line: '.__LINE__.'</strong><br />'; + print_r($admin->getErrors()); +} else { + Var_Dump::display($rights); + echo '<br />'; +} + +// view all with implied and without hierarchy +echo 'All the rights with implied and without hierarchy:<br />'; +$rights = $admin->perm->getRights(array( + 'implied' => true, + 'rekey' => true, + 'filters' => array('right_id' => $right_id) +)); +if ($rights === false) { + echo '<strong>Error on line: '.__LINE__.'</strong><br />'; + print_r($admin->getErrors()); +} else { + Var_Dump::display($rights); + echo '<br />'; +} +*/ +// view all with implied/inherited and without hierarchy +echo 'All the rights with implied/inherited and without hierarchy:<br />'; +$rights = $admin->perm->getRights(array( + 'implied' => array('perm_user_id' => 9), + 'inherited' => array('perm_user_id' => 9), + 'rekey' => true, + 'filters' => array('perm_user_id' => 9), + 'fields' => array( + 'right_id', + 'area_id', + 'right_define_name', + 'has_implied', + ), +)); +if ($rights === false) { + echo '<strong>Error on line: '.__LINE__.'</strong><br />'; + print_r($admin->getErrors()); +} else { + Var_Dump::display($rights); + echo '<br />'; +} +die(); // view all echo 'All the rights:<br />'; $rights = $admin->perm->getRights(); http://cvs.php.net/viewcvs.cgi/pear/LiveUser_Admin/docs/examples/example1/User.php?r1=1.4&r2=1.5&diff_format=u Index: pear/LiveUser_Admin/docs/examples/example1/User.php diff -u pear/LiveUser_Admin/docs/examples/example1/User.php:1.4 pear/LiveUser_Admin/docs/examples/example1/User.php:1.5 --- pear/LiveUser_Admin/docs/examples/example1/User.php:1.4 Tue Feb 7 10:54:58 2006 +++ pear/LiveUser_Admin/docs/examples/example1/User.php Tue Apr 11 16:53:29 2006 @@ -13,12 +13,12 @@ ); if ($i > 10) { - $level = 3; + $data['perm_type'] = 3; } else { - $level = 1; + $data['perm_type'] = 1; } - $user_id = $admin->addUser($data, $level); + $user_id = $admin->addUser($data); if ($user_id === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; print_r($admin->getErrors()); @@ -30,7 +30,7 @@ // Get // Group of users echo 'All the users:<br />'; -$users = $admin->getUsers('auth'); +$users = $admin->getUsers(array('container' => 'auth')); if ($users === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; print_r($admin->getErrors()); @@ -43,7 +43,7 @@ $id = array_rand($users); // single user echo 'This user will be removed:<br />'; - $user = $admin->getUsers('perm', array('filters' => array('perm_user_id' => $users[$id]['perm_user_id']))); + $user = $admin->getUsers(array('filters' => array('perm_user_id' => $users[$id]['perm_user_id']))); if ($user === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; print_r($admin->getErrors()); @@ -72,13 +72,13 @@ 'handle' => 'updated_user'.rand(), 'passwd' => 'foo', ); - $updated = $admin->updateUser($updateUser, $data); + $updated = $admin->updateUser($data, $updateUser); if ($updated === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; print_r($admin->getErrors()); } else { echo '<strong>' . $updateUser . '</strong> was updated<br />'; - $user = $admin->getUsers('perm', array('filters' => array('perm_user_id' => $updateUser))); + $user = $admin->getUsers(array('filters' => array('perm_user_id' => $updateUser))); if ($user === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; @@ -94,7 +94,7 @@ // Get echo 'All the users:<br />'; - $users = $admin->getUsers('auth'); + $users = $admin->getUsers(array('container' => 'auth')); if ($users === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; print_r($admin->getErrors()); @@ -123,8 +123,8 @@ unset($user); echo 'Perm<br />'; - $filter = array('filters' => array('perm_user_id' => '3')); - $user = $admin->perm->getUsers($filter); + $params = array('filters' => array('perm_user_id' => '3')); + $user = $admin->perm->getUsers($params); if ($user === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; print_r($admin->getErrors()); http://cvs.php.net/viewcvs.cgi/pear/LiveUser_Admin/docs/examples/example1/UserGroup.php?r1=1.1&r2=1.2&diff_format=u Index: pear/LiveUser_Admin/docs/examples/example1/UserGroup.php diff -u pear/LiveUser_Admin/docs/examples/example1/UserGroup.php:1.1 pear/LiveUser_Admin/docs/examples/example1/UserGroup.php:1.2 --- pear/LiveUser_Admin/docs/examples/example1/UserGroup.php:1.1 Sat Aug 13 21:33:58 2005 +++ pear/LiveUser_Admin/docs/examples/example1/UserGroup.php Tue Apr 11 16:53:29 2006 @@ -12,7 +12,7 @@ exit; } -$users = $admin->getUsers('auth'); +$users = $admin->getUsers(array('container' => 'auth')); if ($users === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; print_r($admin->getErrors()); http://cvs.php.net/viewcvs.cgi/pear/LiveUser_Admin/docs/examples/example1/UserRights.php?r1=1.3&r2=1.4&diff_format=u Index: pear/LiveUser_Admin/docs/examples/example1/UserRights.php diff -u pear/LiveUser_Admin/docs/examples/example1/UserRights.php:1.3 pear/LiveUser_Admin/docs/examples/example1/UserRights.php:1.4 --- pear/LiveUser_Admin/docs/examples/example1/UserRights.php:1.3 Fri Dec 2 12:41:27 2005 +++ pear/LiveUser_Admin/docs/examples/example1/UserRights.php Tue Apr 11 16:53:29 2006 @@ -2,7 +2,7 @@ require_once 'index.php'; echo '<h3>UserRights</h3>'; -$users = $admin->getUsers('auth'); +$users = $admin->getUsers(array('container' => 'auth')); if ($users === false) { echo '<strong>Error on line: '.__LINE__.'</strong><br />'; print_r($admin->getErrors());

« previous php.pear.cvs (#39551) next »