I made mistakes in this script. On line 4 it should read

mkdir $cart or warn $!;

(I should listen to my own advice)

Also it fails if there is no ACE with everyone as the account. So I rejigged it as follows.

use Win32::Perms; ### # # get_index_of($account_name, $ace) # # Return an array of positions of ACEs # with trustee of $account_name or if called # in scalar context the index of the first matching ACE # ### sub get_index_of { my ($account_name, $ace) = @_; my $index = -1; my @positions; do { $index++; print "$index"; $perm = $$ace[$index]; print $perm; if ($perm->{'Account'} eq $account_name) { push @positions, $i +ndex }; } while ($index < $#$ace); wantscalar and return $positions[0]; return @positions; } $cart='TestingFolder'; mkdir $cart or warn $!; # Create a new Security Descriptor and auto import permissions # from the directory my @perms; my $perm; my $Dir = new Win32::Perms( $cart ) or die; $Dir->Get(\@perms) or die; #Get permissions $Dir->Dump; my $acl_index = get_index_of('Everyone', \@perms); print "Returned ", $acl_index; print $perm->{'Account'}; if (defined $acl_index) { $Dir->Remove($acl_index) or die $!; $Dir->Set() or die$!; } $Dir->Dump;

If you --me can you let me know so I can learn?

--blm--

In reply to Re: Re: Re: Re: win32 ACL problem. by blm
in thread win32 ACL problem. by Discipulus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.