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:
parent
6763128c05
commit
450004431c
|
@ -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>
|
2010-03-04 Sancho Lerena <slerena@gmail.com>
|
||||||
|
|
||||||
* pandoradb_data.sql: Added news, default timezone and other
|
* pandoradb_data.sql: Added news, default timezone and other
|
||||||
|
|
|
@ -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'). " " . print_help_icon("cascade_protection", true);
|
$table->data[2][1] .= print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . print_help_icon("cascade_protection", true);
|
||||||
|
|
||||||
$table->data[3][0] = __('Group');
|
$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[3][1] = print_select ($groups, 'grupo', $grupo, '', '', 0, true);
|
||||||
|
|
||||||
$table->data[4][0] = __('Interval');
|
$table->data[4][0] = __('Interval');
|
||||||
|
|
|
@ -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));
|
$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);
|
$search_sql = sprintf ('WHERE id_grupo = %d', $id_group);
|
||||||
|
}
|
||||||
|
|
||||||
if ($search === true) {
|
if ($search === true) {
|
||||||
//No added search. Show both disabled and non-disabled
|
//No added search. Show both disabled and non-disabled
|
||||||
|
@ -1351,10 +1356,11 @@ function get_all_model_groups () {
|
||||||
*
|
*
|
||||||
* @param string User id
|
* @param string User id
|
||||||
* @param string The privilege to evaluate
|
* @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.
|
* @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)) {
|
if (empty ($id_user)) {
|
||||||
global $config;
|
global $config;
|
||||||
$id_user = $config['id_user'];
|
$id_user = $config['id_user'];
|
||||||
|
@ -1369,6 +1375,8 @@ function get_user_groups ($id_user = false, $privilege = "AR") {
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
if (! give_acl ($id_user, $group["id_grupo"], $privilege))
|
if (! give_acl ($id_user, $group["id_grupo"], $privilege))
|
||||||
continue;
|
continue;
|
||||||
|
if ((!$returnAllGroup) && ($group["id_grupo"] == 1)) //All group
|
||||||
|
continue;
|
||||||
$user_groups[$group['id_grupo']] = $group['nombre'];
|
$user_groups[$group['id_grupo']] = $group['nombre'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue