I am trying to write a script that does a whole bunch of things, but at one point it copies files/folders and needs to set file/dir permissions. I have read thru the module documentation for Win32::FileSecurity, and think I understand it...... sorta. (attached is my section of script). The problem is that after the directory is created and files copied into it, when i look at the permissions of the file/directory, for the most part, the only standard permission listed is "List Folder Contents". some of the other permissions are listed under "Advanced", and some just plain don't exist. Any help would be appreciated.
my %HASH_OF_DIRS = ( '.' => { svc_priv => "none", usr_priv => "RO", src_dir => ".", file_masks => ['default.htm', 'site_config.pl']}, Dir10 => { svc_priv => "none", usr_priv => "RW"}, Dir9 => { svc_priv => "RW", usr_priv => "RO"}, Dir8 => { svc_priv => "none", usr_priv => "RW"}, Dir8 => { svc_priv => "none", usr_priv => "RO", src_dir => "map_images", file_masks => ['*.gif']}, Dir7 => { svc_priv => "none", usr_priv => "RX", src_dir => "map_scripts", file_masks => ['*.idc', '*.htx']}, Dir6 => { svc_priv => "RW", usr_priv => "RW"}, Dir5 => { svc_priv => "none", usr_priv => "RO", src_dir => "tailored_images", file_masks => ['*.gif', '*.jpg']}, Dir4 => { svc_priv => "RX", usr_priv => "RX", src_dir => "tailored_scripts", file_masks => ['*.pl', '*.plx', '*.idc', '*.htx']}, Dir3 => { svc_priv => "none", usr_priv => "RO", src_dir => "tailored_static", file_masks => ['*.txt', '*.htm']}, Dir2 => { svc_priv => "none", usr_priv => "RO", src_dir => "userman_content", file_masks => ['*.pdf']}, DIR1 => { svc_priv => "none", usr_priv => "RS", src_dir => "database", file_masks => ['*.txt']} ); my %dir_masks = ( none => &MakeMask, admin => MakeMask(qw(FULL GENERIC_ALL)), RO => MakeMask(qw(READ GENERIC_READ)), RS => MakeMask(qw(READ GENERIC_READ GENERIC_EXECUTE)), RX => MakeMask(qw(READ GENERIC_READ GENERIC_EXECUTE)), RW => MakeMask(qw(CHANGE GENERIC_READ GENERIC_WRITE)) ); buildFileDirectory($var, \%HASH_OF_DIRS); my ($region_root, $pDirHash) = @_; my %dir_list = %$pDirHash; setRights($region_dir_name, $dir_masks{admin}, $dir_masks{none}, $di +r_masks{none}); sub setRights { use Win32::FileSecurity qw(Get Set MakeMask); my ($dir, $admin_mask, $user_mask, $svc_mask) = @_; my $none_mask = MakeMask; my (%rights, $lc_region, $lc_cof); #if ($debug & $DBG_DIR_CREATE) { print "Get rights for: $dir\n"; } if (Get($dir, \%rights)) { $rights{Administrators} = $admin_mask; $rights{Everyone} = $none_mask; $lc_region = lc $var2; $lc_cof = lc $var; if ($lc_region ne $lc_cof) { $rights{"$region_web_user"} = $user_mask; $rights{"$region_svc_user"} = $svc_mask; } Set($dir, \%rights); } else { print ("Error #", int($!), ": $!\n"); } }

In reply to Win32::FileSecurity and File Permission flubs by banesong

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.