Monks,
What I am trying to do with this following code is to be able to assign permission to folder and sub folder level for a given NT account.
Basically on the command line I type in the script name and then followed with the required permission.
example; c:\myscript READ WRITE
However it doesn't work, because the perms add command expects the permissions to be a constant. My question is; how the hell can I pass @ARGV values to the perms add command as constants? Or is what I am trying to do possible?
In dave Roth’s second book he uses the constants in side the add command (i.e not through variables) and on the perms home page web site @ Roth.net there isn’t one example that shows how this can be achieved.
Can someone please enlighten me on how can I achieve this.
use strict;
use Win32::Perms;
my $path = 'c:/temp';
my $folder_ace = shift @ARGV;
my $subfolder_ace = pop @ARGV;
my $perms = new Win32::Perms($path) || die "\n$^E\n";
print "\nPath: " . $perms->Path();
$perms->Add('MYDOMAIN\bloggJo', $folder_ace|$subfolder_ace, ACCESS_ALL
+OWED_ACE_TYPE, OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE);
if ($perms->Set())
{
print "\nDone\n";
}
else
{
print "\nFailed\n";
}
Many Thanks for your help in advance.
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.