Reception of the rights to the catalogue
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Reception of the rights to the catalogue

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Posts
    4

    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);
    
    
            }

  2. #2
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Lightbulb Re: Reception of the rights to the catalogue

    Last edited by toraj58; November 19th, 2008 at 03:40 AM.
    Please rate my post if it was helpful for you.
    C#, C++, PHP, ASP.NET
    SQL Server, MySQL
    DirectX
    MATH
    Touraj Ebrahimi
    [toraj_e] [at] [yahoo] [dot] [com]

  3. #3
    Join Date
    Sep 2008
    Posts
    4

    Re: Reception of the rights to the catalogue

    Well thanks

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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center