2011-09-01 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_users.php: added the function "users_get_first_group" another parameter, $all_group, to return all group or not, by default is true. Fixes: #3401582 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4882 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c072138d16
commit
4559d28cd3
|
@ -1,3 +1,11 @@
|
|||
2011-09-01 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_users.php: added the function "users_get_first_group"
|
||||
another parameter, $all_group, to return all group or not, by default is
|
||||
true.
|
||||
|
||||
Fixes: #3401582
|
||||
|
||||
2011-09-01 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* ChangeLog: sorry I mistake the number of bug in Sourceforge tracker.
|
||||
|
|
|
@ -158,11 +158,20 @@ function users_get_groups_tree($id_user = false, $privilege = "AR", $returnAllGr
|
|||
*
|
||||
* @param string User id
|
||||
* @param string The privilege to evaluate
|
||||
* @param bool $all_group Flag to return all group, by default true;
|
||||
*
|
||||
* @return array The first group where the user has certain privileges.
|
||||
*/
|
||||
function users_get_first_group ($id_user = false, $privilege = "AR") {
|
||||
return array_shift (array_keys (users_get_groups ($id_user, $privilege)));
|
||||
function users_get_first_group ($id_user = false, $privilege = "AR", $all_group = true) {
|
||||
$groups = array_keys (users_get_groups ($id_user, $privilege));
|
||||
|
||||
$return = array_shift($groups);
|
||||
|
||||
if ((!$all_group) && ($return == 0)) {
|
||||
$return = array_shift($groups);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue