Dave: Thank you x 1000^100 times.
I have modified the sub OnShowFileAttr to get_perms (which retrieves ACE permission information on the selected object)
However, if I may, I have the following questions:
1- every time an object is selected (in the left box), the script will add it to the bottom of the box list on the right. How can I get the script to refresh rather than add it to the end of the list, the reason is if I click on an object, I only need to see it once rather than adding it to the end of the list each time I click on he object?
2- The Directory list is not sorted in the in the order they appear (i.e c:/, then sub directories in that folder) how can I tie it up so they are sorted in the oder they appear?
3- I would like to represent account permission information in a graphical form, ie if its a user account then an Icon representing a single user will appear, or else and Icon representing a group instead?
4- Finally, is it possible (once point 3 implemented) I can move a user account by clicking a dragging then dropping it on top a group Icon? For example if the path c$:/temp has User_a and Group_a allowed to access it, then I drag user_a and drop it on top of the icon representing Group_a, so the path will only show Group_a have accesxs permission and within this group user_a will reaside?
Your help is like a life line to me at the moment. So Thank you very much in advance.
use Tk;
use strict;
use File::Find;
use Tk::Frame;
use Tk::Text;
use Tk::Scrollbar;
use Tk::Adjuster;
use Win32::Perms;
my $path = shift @ARGV;
my $mw = new MainWindow; #main frame
$mw->geometry('400x300');
my $left_frame = $mw->Frame; #left frame
my $adjuster = $mw->Adjuster(-widget=> $left_frame, -side=>'left');
my $right_frame = $mw->Frame; #left frame
# create a list of directories
my %dirs;
find(sub { $dirs{$File::Find::dir}++;}, $path);
my ($list_box) = $left_frame->Scrolled('Listbox',
-height=>'0',
-width=>'0',
-scrollbars=>'e', );
my ($output_text) = $right_frame->Scrolled('Text',
-height=>'1',
-width=>'1',
-scrollbars=>'osoe',);
#Load dir names into the list box
$list_box->insert('end', keys %dirs);
$list_box->bind('<ButtonRelease-1>',sub {get_perms();});
#pack everything
$left_frame->pack(qw/-side left -fill y/);
$adjuster->pack(qw/-side left -fill y/);
$right_frame->pack(qw/-side right -fill both -expand 1/);
$list_box->pack(qw/-side left -fill both -expand 1/);
$output_text->pack(qw/-side bottom -fill both -expand 1/);
+
MainLoop;
exit 0;
sub get_perms
{
my ($indx) = $list_box->curselection();
my $path = $list_box->get($indx);
print $path;
my $perms = new Win32::Perms($path) || die "\n$^E\n";
my $counter = $perms->Get(\ my @list);
foreach my $item (@list)
{
while (my ($f, $v) = each %$item)
{
next if ($f !~ /account|access/i );
$output_text->insert('end', $f.": ".$v."\n");
}
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.