This is a quote directly from the book (Win32 Perl Programming: The Standard Extensions, page 39):
"The capability to specify user-level permissions (that is, permissions assigned to users and/or groups) on a share is currently not supported under any of the standard Win32 extensions."
Then there is another statement some ways later in the book that reads (page 48):
"Currently, the Win32::NetResource extension is not capable of applying account-based permissions on a network share. Users who need to apply permissions can use the Explorer or Server Manager programs that come with WindowsNT."
This is my subroutine:
sub usr_add {
my $obj = shift;
my $usr = shift;
my $bday = Student::get_attr($obj, 'BDAY_ID');
print STDERR "$bday\n";
my @bday = split(/\x2F/,$bday);
$bday = join("",@bday);
print STDERR "$bday\n";
my $hdir = "";
my @buf2;
my $buf1 = Student::get_attr($obj, 'LN');
print STDERR "$buf1\n";
my $buf2 = Student::get_attr($obj, 'FN');
print STDERR "$buf2\n";
$buf2 =~ s/^\s+//;
$buf2 =~ s/\s+$//;
$buf1 =~ s/^\s+//;
$buf1 =~ s/\s+$//;
@buf2 = split(/\s/, $buf2);
$buf2 = "$buf2[0]";
$buf2 =~ s/^\s+//;
$buf2 =~ s/\s+$//;
$hdir = join(',', $buf1, $buf2);
print STDERR "$hdir\n";
my $hdir_srv = 'd:/' . "$hdir";
print STDERR "$hdir_srv\n";
mkdir($hdir_srv, '0777');
my $student_perms = Win32::FileSecurity::MakeMask( qw( CHANGE GENE
+RIC_WRITE GENERIC_READ GENERIC_EXECUTE ) );
my $staff_perms = Win32::FileSecurity::MakeMask( qw( CHANGE GENERI
+C_WRITE GENERIC_READ GENERIC_EXECUTE ) );
my $admin_perms = Win32::FileSecurity::MakeMask( qw(FULL GENERIC_A
+LL) );
my %hdir_perm_hash;
if ( Win32::FileSecurity::Get($hdir_srv, \%hdir_perm_hash) ) {
print STDERR "$hdir_srv has been opened\n";
}
$hdir_perm_hash{'CLC\\Domain Patricians'} = $staff_perms;
$hdir_perm_hash{'CLC\\Domain Admins'} = $admin_perms;
$hdir_perm_hash{'CLC\\Domain Plebs'} = $student_perms;
delete($hdir_perm_hash{'Everyone'});
if ( Win32::FileSecurity::Set($hdir_srv, \%hdir_perm_hash) ) {
print STDERR "$hdir_srv has been set\n";
}
print "\n";
print STDERR "$usr\n";
return($usr, $bday, $hdir);
}
This code works for everything that I've done so far. The next step after creating the directory and setting local permissions for it is to share it and set the permissions for accessing it through the sharepoint (since it will be the user's home directory, we don't want anyone just accessing it any ole way. I might have to hack together a Win32::Registry routine that sets the permissions in the registry itself (I'm still researching that) if that's possible. More updates to come...
Theodore Charles III
Network Administrator
Los Angeles High
email->secon_kun@hotmail.com()
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.