2010-03-04 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_db.php: in function "get_user_groups" add third
	parameter $returnAllGroup by true for default. Fix in the function
	"get_group_agents" now if pass the id_group as 0 or 1 (all group) search
	for all groups.
	
	* godmode/agentes/agent_manager.php: use the new parameter for function
	"get_user_groups" for don't show the all group.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2470 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-03-04 16:50:48 +00:00
parent 6763128c05
commit 450004431c
3 changed files with 22 additions and 4 deletions

View File

@ -1,3 +1,13 @@
2010-03-04 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_db.php: in function "get_user_groups" add third
parameter $returnAllGroup by true for default. Fix in the function
"get_group_agents" now if pass the id_group as 0 or 1 (all group) search
for all groups.
* godmode/agentes/agent_manager.php: use the new parameter for function
"get_user_groups" for don't show the all group.
2010-03-04 Sancho Lerena <slerena@gmail.com>
* pandoradb_data.sql: Added news, default timezone and other

View File

@ -137,7 +137,7 @@ $table->data[2][1] = print_input_text_extended ('id_parent', get_agent_name ($id
$table->data[2][1] .= print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). "&nbsp;" . print_help_icon("cascade_protection", true);
$table->data[3][0] = __('Group');
$groups = get_user_groups ();
$groups = get_user_groups (false, "AR", false);
$table->data[3][1] = print_select ($groups, 'grupo', $grupo, '', '', 0, true);
$table->data[4][0] = __('Interval');

View File

@ -397,10 +397,15 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower", $noA
}
}
if (is_array($id_group))
if (is_array($id_group)) {
$search_sql = sprintf ('WHERE id_grupo IN (%s)', implode (",", $id_group));
else
}
else if (($id_group == 1) || ($id_group == 0)) { //All group
$search_sql = 'WHERE 1 = 1';
}
else {
$search_sql = sprintf ('WHERE id_grupo = %d', $id_group);
}
if ($search === true) {
//No added search. Show both disabled and non-disabled
@ -1351,10 +1356,11 @@ function get_all_model_groups () {
*
* @param string User id
* @param string The privilege to evaluate
* @param boolean $returnAllGroup Flag the return group, by default true.
*
* @return array A list of the groups the user has certain privileges.
*/
function get_user_groups ($id_user = false, $privilege = "AR") {
function get_user_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true) {
if (empty ($id_user)) {
global $config;
$id_user = $config['id_user'];
@ -1369,6 +1375,8 @@ function get_user_groups ($id_user = false, $privilege = "AR") {
foreach ($groups as $group) {
if (! give_acl ($id_user, $group["id_grupo"], $privilege))
continue;
if ((!$returnAllGroup) && ($group["id_grupo"] == 1)) //All group
continue;
$user_groups[$group['id_grupo']] = $group['nombre'];
}