Как я могу изменить полномочия Windows NTFS в Perl?

Я нашел решение, и это все

if(langue == LangueAgence.FR)
                {
                    Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR"); 
                }
                else if(langue == LangueAgence.EN)
                {
                    Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
                }                        

                    AddElement.AddTextAgencyFB(ref cb, Properties.Resources.LINK_Nom_agence.ToUpper(), 239, 817, new BaseColor (49, 140, 231), 12, true,0);
                    AddElement.AddTextAgencyFB(ref cb, Properties.Resources.Link_Nom.ToUpper(), 112, 700, BaseColor.WHITE, 10, false);//Last name
 }

проблема решена

5
задан Mark Allison 6 January 2009 в 12:56
поделиться

2 ответа

Стандартный путь состоит в том, чтобы использовать Win32:: модуль FileSecurity:

use Win32::FileSecurity qw(Set MakeMask);

my $dir = 'c:/newdir';
mkdir $dir or die $!;
Set($dir, { 'Power Users' 
            => MakeMask( qw( READ GENERIC_READ GENERIC_EXECUTE ) ) });

Отметьте это Set перезапишет полномочия для того каталога. Если бы Вы хотите отредактировать существующие полномочия, Вы должны были бы Get их сначала:

my %permissions;
Win32::FileSecurity::Get($dir, \%permissions);
$permissions{'Power Users'}
  = MakeMask( qw( READ GENERIC_READ GENERIC_EXECUTE ) ) });
Win32::FileSecurity::Set($dir, \%permissions);
10
ответ дан 18 December 2019 в 09:54
поделиться

Вот универсальный пакет полномочий для ActivePerl.

use Win32::Perms;

# Create a new Security Descriptor and auto import permissions
# from the directory
$Dir = new Win32::Perms( 'c:/temp' ) || die;

# One of three ways to remove an ACE
$Dir->Remove('guest');

# Deny access for all attributes (deny read, deny write, etc)
$Dir->Deny( 'joel', FULL );

# Set the directory permissions (no need to specify the
# path since the object was created with it)
$Dir->Set();

# If you are curious about the contents of the SD
# dump the contents to STDOUT $Dir->Dump;
7
ответ дан 18 December 2019 в 09:54
поделиться
Другие вопросы по тегам:

Похожие вопросы: