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
9cece1378a
commit
b3157d1160
|
@ -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>
|
2011-09-01 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* ChangeLog: sorry I mistake the number of bug in Sourceforge tracker.
|
* 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 User id
|
||||||
* @param string The privilege to evaluate
|
* @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.
|
* @return array The first group where the user has certain privileges.
|
||||||
*/
|
*/
|
||||||
function users_get_first_group ($id_user = false, $privilege = "AR") {
|
function users_get_first_group ($id_user = false, $privilege = "AR", $all_group = true) {
|
||||||
return array_shift (array_keys (users_get_groups ($id_user, $privilege)));
|
$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