mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-21 17:08:52 +02:00
Smart services RC1
This commit is contained in:
parent
a0d489b90e
commit
c6db39dce1
@ -96,6 +96,7 @@ our @EXPORT = qw(
|
|||||||
get_user_disabled
|
get_user_disabled
|
||||||
get_user_exists
|
get_user_exists
|
||||||
get_user_profile_id
|
get_user_profile_id
|
||||||
|
get_group_children
|
||||||
is_agent_address
|
is_agent_address
|
||||||
is_group_disabled
|
is_group_disabled
|
||||||
get_agent_status
|
get_agent_status
|
||||||
@ -292,6 +293,46 @@ sub get_group_id ($$) {
|
|||||||
return defined ($rc) ? $rc : -1;
|
return defined ($rc) ? $rc : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Return a array of groups, children of given parent.
|
||||||
|
########################################################################
|
||||||
|
sub get_group_children ($$$;$);
|
||||||
|
sub get_group_children ($$$;$) {
|
||||||
|
my ($dbh, $parent, $ignorePropagate, $href_groups) = @_;
|
||||||
|
|
||||||
|
if (is_empty($href_groups)) {
|
||||||
|
my @groups = get_db_rows($dbh, 'tgrupo');
|
||||||
|
|
||||||
|
my $href_groups = map {
|
||||||
|
$_->{'id_grupo'} => $_
|
||||||
|
} @groups
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
my $return = {};
|
||||||
|
foreach my $id_grupo (keys %{$href_groups}) {
|
||||||
|
if ($id_grupo eq 0) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $g = $href_groups->{$id_grupo};
|
||||||
|
|
||||||
|
if ($ignorePropagate || $parent eq 0 || $href_groups->{$parent}{'propagate'}) {
|
||||||
|
if ($g->{'parent'} eq $parent) {
|
||||||
|
$return->{$g->{'id_grupo'}} = $g;
|
||||||
|
if ($g->{'propagate'} || $ignorePropagate) {
|
||||||
|
$return = add_hashes(
|
||||||
|
$return,
|
||||||
|
get_group_children($dbh, $g->{'id_grupo'}, $ignorePropagate, $href_groups)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
## Return OS ID given the OS name.
|
## Return OS ID given the OS name.
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -117,6 +117,7 @@ our @EXPORT = qw(
|
|||||||
is_offline
|
is_offline
|
||||||
is_empty
|
is_empty
|
||||||
is_in_array
|
is_in_array
|
||||||
|
add_hashes
|
||||||
to_number
|
to_number
|
||||||
clean_blank
|
clean_blank
|
||||||
credential_store_get_key
|
credential_store_get_key
|
||||||
@ -683,6 +684,30 @@ sub is_in_array {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Mix hashses
|
||||||
|
################################################################################
|
||||||
|
sub add_hashes {
|
||||||
|
my $_h1 = shift;
|
||||||
|
my $_h2 = shift;
|
||||||
|
|
||||||
|
if (ref($_h1) ne "HASH") {
|
||||||
|
return \%{$_h2} if (ref($_h2) eq "HASH");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ref($_h2) ne "HASH") {
|
||||||
|
return \%{$_h1} if (ref($_h1) eq "HASH");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ref($_h1) ne "HASH") && (ref($_h2) ne "HASH")) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
my %ret = (%{$_h1}, %{$_h2});
|
||||||
|
|
||||||
|
return \%ret;
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# SUB md5check (param_1, param_2)
|
# SUB md5check (param_1, param_2)
|
||||||
# Verify MD5 file .checksum
|
# Verify MD5 file .checksum
|
||||||
|
Loading…
x
Reference in New Issue
Block a user