You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

66 lines
1.7 KiB

  1. using System.Collections.Generic;
  2. using System.Security.AccessControl;
  3. namespace Security2
  4. {
  5. public class FileSystemEffectivePermissionEntry
  6. {
  7. private IdentityReference2 account;
  8. private uint accessMask;
  9. private string objectPath;
  10. public IdentityReference2 Account { get { return account; } }
  11. public uint AccessMask { get { return accessMask; } }
  12. public string FullName { get { return objectPath; } }
  13. public string Name
  14. {
  15. get
  16. {
  17. if (!string.IsNullOrEmpty(FullName))
  18. {
  19. return System.IO.Path.GetFileName(FullName);
  20. }
  21. else
  22. {
  23. return null;
  24. }
  25. }
  26. }
  27. public FileSystemRights AccessRights
  28. {
  29. get
  30. {
  31. return (FileSystemRights)accessMask;
  32. }
  33. }
  34. private List<string> accessAsString;
  35. public List<string> AccessAsString { get { return accessAsString; } }
  36. public FileSystemEffectivePermissionEntry(IdentityReference2 identity, uint AccessMask, string FullName)
  37. {
  38. this.account = identity;
  39. this.accessMask = AccessMask;
  40. this.objectPath = FullName;
  41. this.accessAsString = new List<string>();
  42. if (accessMask == 0)
  43. {
  44. accessAsString.Add("None");
  45. }
  46. else
  47. {
  48. string tempString = ((FileSystemRights)this.accessMask).ToString();
  49. foreach (var s in tempString.Split(','))
  50. {
  51. this.accessAsString.Add(s);
  52. }
  53. }
  54. }
  55. }
  56. }