Merge branch 'ent-6865-uniway-funcionalidad-password-en-grupos-no-compatible-con-discovery-plugins-xml' into 'develop'

Ent 6865 uniway funcionalidad password en grupos no compatible con discovery plugins xml

See merge request artica/pandorafms!3761
This commit is contained in:
Daniel Rodriguez 2021-03-22 12:39:59 +00:00
commit a7b19bd347
2 changed files with 30 additions and 2 deletions

View File

@ -105,6 +105,23 @@ class Group extends Entity
}
/**
* Alias of 'nombre'.
*
* @param string|null $name Name of group.
*
* @return string|void Name assigned or void if set operation.
*/
public function name(?string $name=null)
{
if ($name === null) {
return $this->nombre();
}
return $this->nombre($name);
}
/**
* Retrieves a list of groups fitered.
*
@ -119,7 +136,7 @@ class Group extends Entity
if (empty($filter['id_user']) === true) {
// By default query current user groups.
$filter['id_user'] = false;
} else if (!\users_is_admin()) {
} else if ((bool) \users_is_admin() === false) {
// Override user queried if user is not an admin.
$filter['id_user'] = false;
}
@ -226,8 +243,9 @@ class Group extends Entity
if (isset($config['centralized_management']) === true
&& $config['centralized_management'] > 0
) {
$msg = 'cannot be modified in a centralized management environment';
throw new \Exception(
get_class($this).' error, cannot be modified while centralized management environment.'
get_class($this).' error, '.$msg
);
}

View File

@ -504,10 +504,20 @@ sub print_agent {
# print header
$xml .= "<agent_data ";
my $group_password_specified = 0;
foreach my $kad (keys %{$agent_data}){
no warnings "uninitialized";
$xml .= $kad . "='";
$xml .= $agent_data->{$kad} . "' ";
if ($kad eq 'group_password') {
$group_password_specified = 1;
}
}
if ($group_password_specified == 0 && !empty($config->{'group_password'})) {
$xml .= " group_password='".$config->{'group_password'}."' ";
}
$xml .= ">";