mscorlib(4.0.0.0) API with additions
FileSecurity.cs
1 using Microsoft.Win32.SafeHandles;
2 using System.IO;
4 
6 {
8  public sealed class FileSecurity : FileSystemSecurity
9  {
12  [SecuritySafeCritical]
13  public FileSecurity()
14  : base(isContainer: false)
15  {
16  }
17 
33  [SecuritySafeCritical]
34  [SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
35  public FileSecurity(string fileName, AccessControlSections includeSections)
36  : base(isContainer: false, fileName, includeSections, isDirectory: false)
37  {
38  string fullPathInternal = Path.GetFullPathInternal(fileName);
39  FileIOPermission.QuickDemand(FileIOPermissionAccess.NoAccess, AccessControlActions.View, fullPathInternal, checkForDuplicates: false, needFullPath: false);
40  }
41 
42  [SecurityCritical]
43  [SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
44  internal FileSecurity(SafeFileHandle handle, string fullPath, AccessControlSections includeSections)
45  : base(isContainer: false, handle, includeSections, isDirectory: false)
46  {
47  if (fullPath != null)
48  {
49  FileIOPermission.QuickDemand(FileIOPermissionAccess.NoAccess, AccessControlActions.View, fullPath);
50  }
51  else
52  {
53  FileIOPermission.QuickDemand(PermissionState.Unrestricted);
54  }
55  }
56  }
57 }
Describes a set of security permissions applied to code. This class cannot be inherited.
FileIOPermissionAccess
Specifies the type of file access requested.
FileSecurity(string fileName, AccessControlSections includeSections)
Initializes a new instance of the T:System.Security.AccessControl.FileSecurity class from a specified...
Definition: FileSecurity.cs:35
Represents the access control and audit security for a file or directory.
Represents the access control and audit security for a file. This class cannot be inherited.
Definition: FileSecurity.cs:8
Definition: __Canon.cs:3
FileSecurity()
Initializes a new instance of the T:System.Security.AccessControl.FileSecurity class.
Definition: FileSecurity.cs:13
SecurityAction
Specifies the security actions that can be performed using declarative security.
AccessControlActions
Specifies the actions that are permitted for securable objects.
PermissionState
Specifies whether a permission should have all or no access to resources at creation.
Controls the ability to access files and folders. This class cannot be inherited.
AccessControlSections
Specifies which sections of a security descriptor to save or load.
Performs operations on T:System.String instances that contain file or directory path information....
Definition: Path.cs:13