Created
June 19, 2023 14:04
-
-
Save earnhardt3rd/ece3b7c7cff9acf524fcd1ecf02a2e7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'getopts.pl'; | |
Getopts('m:d:t'); | |
my $MODE = uc($opt_m) || ""; | |
my $DEBUG = $opt_d || 0; | |
if (defined $opt_t) { my %TEST = &_zDEL_USER_BIN();} | |
1; | |
sub _zDEL_USER_BIN { | |
my $os_user = shift || $USERNAME; | |
my $userbin = $os_user; | |
print " _USER_BIN($os_user)\n" if $DEBUG > 1; | |
if (scalar(keys %AUTHORIZED) <= 0) {&_LOAD_AUTHORIZED();} | |
if (scalar(keys %AUTHORIZED) > 0) { | |
if (exists($AUTHORIZED{$os_user}{"BIN"})) {$userbin=$OS_FOLDERS{"BIN"} . $SLASH . $AUTHORIZED{$os_user}{"BIN"};} | |
} | |
print " USER_BIN:$userbin\n"; | |
return $userbin; | |
my $UBIN_FILTER="INT,ACTIVE=Y,$authKey=$os_user\$,BIN"; | |
my @USER_BIN = &_SHOW_HASH_CLEAN($UBIN_FILTER,%CONFIG_USERS); | |
if (scalar(@USER_BIN) == 1) { | |
if (exists(${$USER_BIN[0]}{"BIN"})) { | |
if (${$USER_BIN[0]}{"BIN"} ne $USERNAME) { | |
print " NEW USER_BIN:=" . ${$USER_BIN[0]}{"BIN"} . "\n" if $DEBUG > 1; | |
$OS_FOLDERS{"UBIN"} = $OS_FOLDERS{"BIN"} . $SLASH . ${$USER_BIN[0]}{"BIN"}; | |
$userbin=${$USER_BIN[0]}{"BIN"}; | |
} | |
} | |
} else { | |
my $wFlag=0; | |
my $wMsg = "*** For some unknown reason, the following process "; | |
if (scalar(@USER_BIN) > 0) { | |
my %USRNMCNT; | |
$wMsg = "multiple records!\n"; | |
$wMsg.=" METHOD:\&_SHOW_HASH_CLEAN(\"ACTIVE=Y,$authKey=$USERNAME,BIN\",\%CONFIG_USERS);\n"; | |
$wMsg.= "---\n"; | |
for (my $ui=0;$ui<=scalar(@USER_BIN)-1 ;$ui++) { | |
if (ref $USER_BIN[$ui] eq 'HASH') { | |
if (exists(${$USER_BIN[$ui]}{$authKey})) { | |
if (!exists($USRNMCNT{${$USER_BIN[$ui]}{$authKey}})) { | |
$USRNMCNT{${$USER_BIN[$ui]}{$authKey}}=0; | |
} else { | |
$USRNMCNT{${$USER_BIN[$ui]}{$authKey}} = $USRNMCNT{${$USER_BIN[$ui]}{$authKey}} + 1; | |
} | |
} | |
foreach my $ukey(sort keys %{$USER_BIN[$ui]}) { | |
$wMsg.= sprintf("%0.2d %-25s %-s\n",$ui,$ukey,${$USER_BIN[$ui]}{$ukey}); | |
} | |
} | |
} | |
if (scalar(keys %USRNMCNT) > 0) { | |
foreach my $ukey(sort keys %USRNMCNT) { | |
if ($USRNMCNT{$ukey} > 0) { | |
$wFlag++; | |
} | |
} | |
} | |
} else { | |
$wMsg = "zero records!\n"; | |
$wMsg.=" METHOD:\&_SHOW_HASH_CLEAN(\"ACTIVE=Y,$authKey=$USERNAME,BIN\",\%CONFIG_USERS);\n"; | |
if (exists($ADM{lc($USERNAME)})) { | |
print " Hello $USERNAME, please note that you are not registered within pdm_users!\n"; | |
} | |
$wFlag++; | |
} | |
if ($wFlag > 0) { | |
&_WARNING($wMsg); | |
} | |
} | |
if ($DEBUG > 1) { | |
for (my $ui=0;$ui<=scalar(@USER_BIN)-1 ;$ui++) { | |
if (ref $USER_BIN[$ui] eq 'HASH') { | |
foreach my $key(sort keys %{$USER_BIN[$ui]}) { | |
printf " %-0.2d %-25s :%-s\n",$ui,$key,${$USER_BIN[$ui]}{$key}; | |
} | |
} | |
} | |
} | |
print " _USER_BIN($os_user) -> $userbin\n" if $DEBUG > 1; | |
return $userbin; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment