예제 #1
0
        public static void SetAccessControl(this FileInfo fileInfo, FileSecurity fileSecurity)
        {
            if (fileSecurity == null)
                throw new ArgumentNullException(nameof(fileSecurity));
            Contract.EndContractBlock();

            String fullPath = Path.GetFullPath(fileInfo.FullName);
            // Appropriate security check should be done for us by FileSecurity.
            fileSecurity.Persist(fullPath);
        }
예제 #2
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public static void SetAccessControl(this FileStream fileStream, FileSecurity fileSecurity)
        {
            SafeFileHandle handle = fileStream.SafeFileHandle;

            if (fileSecurity == null)
                throw new ArgumentNullException(nameof(fileSecurity));
            Contract.EndContractBlock();

            if (handle.IsClosed)
            {
                throw new ObjectDisposedException(null, SR.ObjectDisposed_FileClosed);
            }

            fileSecurity.Persist(handle, fileStream.Name);
        }
예제 #3
0
파일: File.cs 프로젝트: dasMulli/coreclr
        [System.Security.SecuritySafeCritical]  // auto-generated
        public static void SetAccessControl(String path, FileSecurity fileSecurity)
        {
            if (fileSecurity == null)
                throw new ArgumentNullException("fileSecurity");
            Contract.EndContractBlock();

            String fullPath = Path.GetFullPathInternal(path);
            // Appropriate security check should be done for us by FileSecurity.
            fileSecurity.Persist(fullPath);
        }
 public void SetAccessControl(FileSecurity fileSecurity)
 {
     if (fileSecurity == null)
     {
         throw new ArgumentNullException("fileSecurity");
     }
     if (this._handle.IsClosed)
     {
         __Error.FileNotOpen();
     }
     fileSecurity.Persist(this._handle, this._fileName);
 }
 public static void SetAccessControl(string path, FileSecurity fileSecurity)
 {
     if (fileSecurity == null)
     {
         throw new ArgumentNullException("fileSecurity");
     }
     string fullPathInternal = Path.GetFullPathInternal(path);
     fileSecurity.Persist(fullPathInternal);
 }