Created
June 19, 2023 14:04
-
-
Save earnhardt3rd/80f509852d1dd6ad2e8aafc94f765ac6 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 = &_TOOL_ACCESS();} | |
1; | |
sub _TOOL_ACCESS { | |
my $in_tool = $_[0]; | |
my $tool_name = $in_tool; | |
if (! exists($TOOLS{$tool_name})) { | |
$tool_name = "pdm_" . $tool_name; | |
if (! exists($TOOLS{$tool_name})) { | |
return "ERROR! No Tool Found IN( $in_tool ) & ( $tool_name )"; | |
} | |
} | |
my ($app,$sort,$access,$label) = split(',',$TOOLS{$tool_name}); | |
print " DEBUG:----------------------------------\n" if $DEBUG > 100; | |
print " DEBUG:TOOL APP :$app\n" if $DEBUG > 100; | |
print " DEBUG:TOOL SORT :$sort\n" if $DEBUG > 100; | |
print " DEBUG:TOOL ACCESS:$access\n" if $DEBUG > 100; | |
print " DEBUG:TOOL LABEL :$label\n" if $DEBUG > 100; | |
if (!defined($USER_ACCESS)) {$USER_ACCESS="";} | |
if (exists($APPS{$app})) { | |
if (exists($LICS{$app})) { | |
if ($USER_ACCESS =~ /${access}/ or $USER_ACCESS =~ /ADMIN/) { | |
printf " DEBUG:APP:%-5s %-25s for TOOL:%-20s as ACCESS:%-s\n",$app,"CONFIRMED",$tool_name,$access if $DEBUG > 0; | |
} | |
return $access; | |
} else { | |
if ($USER_ACCESS =~ /${access}/ or $USER_ACCESS =~ /ADMIN/) { | |
printf " DEBUG:APP:%-5s %-25s for TOOL:%-20s as ACCESS:%-s\n",$app,"NOT LICENSED",$tool_name,$access if $DEBUG > 0; | |
} | |
} | |
} else { | |
if (uc($app) eq "PDM") { | |
if (exists($LICS{$app})) { | |
if ($USER_ACCESS =~ /${access}/ or $USER_ACCESS =~ /ADMIN/) { | |
printf " DEBUG:APP:%-5s %-25s for TOOL:%-20s as ACCESS:%-s\n",$app,"CONFIRMED",$tool_name,$access if $DEBUG > 0; | |
} | |
return $access; | |
} else { | |
if ($USER_ACCESS =~ /${access}/ or $USER_ACCESS =~ /ADMIN/) { | |
printf " DEBUG:APP:%-5s %-25s for TOOL:%-20s as ACCESS:%-s\n",$app,"NOT LICENSED",$tool_name,$access if $DEBUG > 0; | |
} | |
} | |
} else { | |
if ($USER_ACCESS =~ /${access}/ or $USER_ACCESS =~ /ADMIN/) { | |
printf " DEBUG:APP:%-5s %-25s for TOOL:%-20s as ACCESS:%-s\n",$app,"NOT CONFIGURED",$tool_name,$access if $DEBUG > 0; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment