-
November 19th, 2008, 04:14 AM
#1
Reception of the rights to the catalogue
There is such code. On a call dSecurity.ModifyAccessRule appears System.Security.Principal.IdentityNotMappedException
What not so?
Code:
public void AddDirectorySecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
{
// Create a new DirectoryInfo object.
DirectoryInfo dInfo = new DirectoryInfo(FileName);
// Get a DirectorySecurity object that represents the
// current security settings.
DirectorySecurity dSecurity = dInfo.GetAccessControl();
FileSystemAccessRule fsAccess = new FileSystemAccessRule(
Account, Rights,
InheritanceFlags.None,
PropagationFlags.NoPropagateInherit,
ControlType);
bool allOK;
dSecurity.ModifyAccessRule(AccessControlModification.Add, fsAccess, out allOK);
if (!allOK)
throw new ApplicationException("Unable to add access rule to directory," + FileName + ", for " + Account);
// Устанавливаем правила наследвания доступа
FileSystemAccessRule inheritanceRule = new FileSystemAccessRule(
Account, Rights,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.InheritOnly,
ControlType);
dSecurity.ModifyAccessRule(AccessControlModification.Add, inheritanceRule, out allOK);
if (!allOK)
throw new ApplicationException("Unable to add inheritance rule to directory," + FileName + ", for " + Account);
// Устанавливаем новые параметры доступа.
dInfo.SetAccessControl(dSecurity);
}
-
November 19th, 2008, 04:35 AM
#2
Re: Reception of the rights to the catalogue
Last edited by toraj58; November 19th, 2008 at 04:40 AM.
Please rate my post if it was helpful for you. Java, C#, C++, PHP, ASP.NET
SQL Server, MySQL
DirectX
MATH Touraj Ebrahimi
[toraj_e] [at] [yahoo] [dot] [com]
-
November 19th, 2008, 03:59 PM
#3
Re: Reception of the rights to the catalogue
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|