Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I have a problem: I shall explain (poorly maybe so please bear with me :-)
I have this code which simply extracts access permission information from an object (in my case, it's always a directory), displays the information on the screen and and I should be able to remove permission from a given account name(lets say the 'Everyone' account) off every directory/sub-directory from a given location (lets say \\srv1\d$).
I have a test drive (lets say d:/) and assigned access permissions to Domain Admins, Everyone and myself, I also have ensured that the ”Allow inherited permissions from parent to propagate to this object” is checked. Which means that the permissions are inherited on all accounts.
When I run my script (on Windows 2000 based PC) it removes permissions for the top level only, i.e. all sub folder below it are left intact.
Can some please tell what am I doing wrong. I REALLY appreciate your help.
use strict; use Win32::Perms; my $path = 'd:/'; my $acc = 'everyone'; my $prms = new Win32::Perms($path); print "\n\nPATH '" . $prms->Path() . "'\n"; my @list; my $total=0; my $indx = $prms->Get(\@list); print "index( number of entries )= $indx\n"; foreach my $rec_ref (@list) { print "\n***********************\n"; print "Record reference: $rec_ref\n"; foreach my $role (keys %$rec_ref) { print "$role = $rec_ref->{$role}\n"; } } $prms -> Dump; while ($indx--) { print "INDEX NUMBER: $indx\n"; my $rec_ref = $list[$indx]; foreach my $role (keys %$rec_ref) { next unless ($role =~ /account/i); print "$role = $rec_ref->{$role}\n"; if ($rec_ref->{$role} =~ /$acc/i) { print "Permission for this account will be removed\n"; if ( $rec_ref->{Flag} && INHERITED_ACE ) { print "\nFound inheretance here\n"; $total += $prms ->Remove($indx); $prms -> Set( ); } else { $prms ->Remove($indx); $prms -> Set( ); } } } print "****************************\n"; } $prms -> Dump;

In reply to Inherited Permissions by blackadder

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found